Beispiel #1
0
        public DefaultSubscriberExecutor(MethodMatcherCache selector,
                                         IConsumerInvokerFactory consumerInvokerFactory,
                                         ICallbackMessageSender callbackMessageSender,
                                         ILogger <DefaultSubscriberExecutor> logger)
        {
            _selector = selector;
            _callbackMessageSender = callbackMessageSender;
            _logger = logger;

            Invoker = consumerInvokerFactory.CreateInvoker();
        }
        public void Start(CancellationToken stoppingToken)
        {
            _selector              = _serviceProvider.GetService <MethodMatcherCache>();
            _dispatcher            = _serviceProvider.GetService <IDispatcher>();
            _serializer            = _serviceProvider.GetService <ISerializer>();
            _storage               = _serviceProvider.GetService <IDataStorage>();
            _consumerClientFactory = _serviceProvider.GetService <IConsumerClientFactory>();

            stoppingToken.Register(() => _cts?.Cancel());

            Execute();
        }
Beispiel #3
0
        public ConsumerRegister(ILogger <ConsumerRegister> logger, IServiceProvider serviceProvider)
        {
            _logger          = logger;
            _serviceProvider = serviceProvider;

            _options  = serviceProvider.GetService <IOptions <CapOptions> >().Value;
            _selector = serviceProvider.GetService <MethodMatcherCache>();
            _consumerClientFactory = serviceProvider.GetService <IConsumerClientFactory>();
            _dispatcher            = serviceProvider.GetService <IDispatcher>();
            _serializer            = serviceProvider.GetService <ISerializer>();
            _storage = serviceProvider.GetService <IDataStorage>();
            _cts     = new CancellationTokenSource();
        }
Beispiel #4
0
 public ConsumerRegister(ILogger <ConsumerRegister> logger,
                         IOptions <CapOptions> options,
                         MethodMatcherCache selector,
                         IConsumerClientFactory consumerClientFactory,
                         IDispatcher dispatcher,
                         ISerializer serializer,
                         IDataStorage storage)
 {
     _options  = options.Value;
     _selector = selector;
     _logger   = logger;
     _consumerClientFactory = consumerClientFactory;
     _dispatcher            = dispatcher;
     _serializer            = serializer;
     _storage = storage;
     _cts     = new CancellationTokenSource();
 }