Ejemplo n.º 1
0
        public void Start(CancellationToken token)
        {
            log.LogInformation("{LogPrefix}Starting", logPrefix);

            try
            {
                stateConsumer = InitializeStateConsumer();
            }
            catch (Exception e) {
                log.LogWarning(
                    $"{logPrefix}Error happened during initialization of the global state store; this thread has shutdown : {e}");
                throw;
            }

            this.token = token;

            thread.Start();
        }
Ejemplo n.º 2
0
        public void Start(CancellationToken token)
        {
            log.Info($"{logPrefix}Starting");

            try
            {
                stateConsumer = InitializeStateConsumer();
            }
            catch
            {
                SetState(GlobalThreadState.PENDING_SHUTDOWN);
                SetState(GlobalThreadState.DEAD);

                log.Warn($"{logPrefix}Error happened during initialization of the global state store; this thread has shutdown");

                throw;
            }

            this.token = token;

            thread.Start();
        }
Ejemplo n.º 3
0
 private StateConsumer InitializeStateConsumer()
 {
     try
     {
         var consumer = new StateConsumer(
             globalConsumer,
             globalStateMaintainer,
             // if poll time is bigger than int allows something is probably wrong anyway
             new TimeSpan(0, 0, 0, 0, (int)configuration.PollMs),
             new TimeSpan(0, 0, 0, 0, (int)configuration.CommitIntervalMs));
         consumer.Initialize();
         return(consumer);
     }
     catch (StreamsException)
     {
         throw;
     }
     catch (Exception e)
     {
         throw new StreamsException("Exception caught during initialization of GlobalStreamThread", e);
     }
 }