Exemplo n.º 1
0
        protected override async Task RunAsync(CancellationToken cancellationToken)
        {
            var initialised = false;

            try
            {
                logger.LogDebug("Starting the Earning Events service.");
                jobContextManager = lifetimeScope.Resolve <IJobContextManager <JobContextMessage> >();
                jobContextManager.OpenAsync(cancellationToken);
                initialised = true;
                logger.LogInfo("Started the Earning Events service.");
                await Task.Delay(Timeout.Infinite, cancellationToken);
            }
            catch (Exception exception) when(!(exception is TaskCanceledException))
            {
                // Ignore, as an exception is only really thrown on cancellation of the token.
                logger.LogError($"Reference Data Stateless Service Exception. Error: {exception}.", exception);
            }
            finally
            {
                if (initialised)
                {
                    logger.LogInfo("Earning Events Stateless Service End");
                    await jobContextManager.CloseAsync();
                }
            }
        }
Exemplo n.º 2
0
 public Stateless(StatelessServiceContext context, IJobContextManager <JobContextMessage> jobContextManager)
     : base(context)
 {
     _jobContextManager = jobContextManager;
 }
Exemplo n.º 3
0
 public JobContextManagerService(IPaymentLogger logger, IJobContextManager <JobContextMessage> jobContextManager)
 {
     this.logger            = logger ?? throw new ArgumentNullException(nameof(logger));
     this.jobContextManager = jobContextManager ?? throw new ArgumentNullException(nameof(jobContextManager));
 }