public ServiceBusListener(string functionId, EntityType entityType, string entityPath, bool isSessionsEnabled, ITriggeredFunctionExecutor triggerExecutor, ServiceBusOptions config, ServiceBusAccount serviceBusAccount, MessagingProvider messagingProvider, ILoggerFactory loggerFactory, bool singleDispatch) { _functionId = functionId; _entityType = entityType; _entityPath = entityPath; _isSessionsEnabled = isSessionsEnabled; _triggerExecutor = triggerExecutor; _cancellationTokenSource = new CancellationTokenSource(); _messagingProvider = messagingProvider; _serviceBusAccount = serviceBusAccount; _loggerFactory = loggerFactory; _logger = loggerFactory.CreateLogger <ServiceBusListener>(); _batchReceiver = CreateMessageReceiver(); _sessionClient = CreateSessionClient(); _scaleMonitor = new Lazy <ServiceBusScaleMonitor>(() => new ServiceBusScaleMonitor(_functionId, _entityType, _entityPath, _serviceBusAccount.ConnectionString, _batchReceiver, _loggerFactory)); _singleDispatch = singleDispatch; if (_isSessionsEnabled) { _sessionMessageProcessor = _messagingProvider.CreateSessionMessageProcessor(_entityPath, _serviceBusAccount.ConnectionString); } else { _messageProcessor = _messagingProvider.CreateMessageProcessor(entityPath, _serviceBusAccount.ConnectionString); } _serviceBusOptions = config; }
public ServiceBusListener( string functionId, EntityType entityType, string entityPath, bool isSessionsEnabled, ITriggeredFunctionExecutor triggerExecutor, ServiceBusOptions options, string connection, MessagingProvider messagingProvider, ILoggerFactory loggerFactory, bool singleDispatch, ServiceBusClientFactory clientFactory) { _functionId = functionId; _entityType = entityType; _entityPath = entityPath; _isSessionsEnabled = isSessionsEnabled; _triggerExecutor = triggerExecutor; _cancellationTokenSource = new CancellationTokenSource(); _messagingProvider = messagingProvider; _loggerFactory = loggerFactory; _logger = loggerFactory.CreateLogger <ServiceBusListener>(); _client = new Lazy <ServiceBusClient>(() => clientFactory.CreateClientFromSetting(connection)); _batchReceiver = new Lazy <ServiceBusReceiver>(() => _messagingProvider.CreateBatchMessageReceiver(_client.Value, _entityPath)); _messageProcessor = new Lazy <MessageProcessor>(() => _messagingProvider.CreateMessageProcessor(_client.Value, _entityPath)); _sessionMessageProcessor = new Lazy <SessionMessageProcessor>(() => _messagingProvider.CreateSessionMessageProcessor(_client.Value, _entityPath)); _scaleMonitor = new Lazy <ServiceBusScaleMonitor>(() => new ServiceBusScaleMonitor(_functionId, _entityType, _entityPath, connection, _batchReceiver, _loggerFactory, clientFactory)); _singleDispatch = singleDispatch; _serviceBusOptions = options; }
public ServiceBusListener(string entityPath, ServiceBusTriggerExecutor triggerExecutor, ServiceBusOptions config, ServiceBusAccount serviceBusAccount, MessagingProvider messagingProvider) { _entityPath = entityPath; _triggerExecutor = triggerExecutor; _cancellationTokenSource = new CancellationTokenSource(); _messagingProvider = messagingProvider; _serviceBusAccount = serviceBusAccount; _messageProcessor = messagingProvider.CreateMessageProcessor(entityPath, _serviceBusAccount.ConnectionString); }
public ServiceBusListener(string entityPath, bool isSessionsEnabled, ServiceBusTriggerExecutor triggerExecutor, ServiceBusOptions config, ServiceBusAccount serviceBusAccount, MessagingProvider messagingProvider) { _entityPath = entityPath; _isSessionsEnabled = isSessionsEnabled; _triggerExecutor = triggerExecutor; _cancellationTokenSource = new CancellationTokenSource(); _messagingProvider = messagingProvider; _serviceBusAccount = serviceBusAccount; if (_isSessionsEnabled) { _sessionMessageProcessor = _messagingProvider.CreateSessionMessageProcessor(entityPath, _serviceBusAccount.ConnectionString); } else { _messageProcessor = _messagingProvider.CreateMessageProcessor(entityPath, _serviceBusAccount.ConnectionString); } _serviceBusOptions = config; }
public ServiceBusListener( string functionId, ServiceBusEntityType entityType, string entityPath, bool isSessionsEnabled, bool autoCompleteMessages, ITriggeredFunctionExecutor triggerExecutor, ServiceBusOptions options, string connection, MessagingProvider messagingProvider, ILoggerFactory loggerFactory, bool singleDispatch, ServiceBusClientFactory clientFactory, ConcurrencyManager concurrencyManager) { _entityPath = entityPath; _isSessionsEnabled = isSessionsEnabled; _autoCompleteMessages = autoCompleteMessages; _triggerExecutor = triggerExecutor; _cancellationTokenSource = new CancellationTokenSource(); _logger = loggerFactory.CreateLogger <ServiceBusListener>(); _functionId = functionId; _client = new Lazy <ServiceBusClient>( () => clientFactory.CreateClientFromSetting(connection)); _batchReceiver = new Lazy <ServiceBusReceiver>( () => messagingProvider.CreateBatchMessageReceiver( _client.Value, _entityPath, options.ToReceiverOptions())); _messageProcessor = new Lazy <MessageProcessor>( () => { var processorOptions = options.ToProcessorOptions(_autoCompleteMessages, concurrencyManager.Enabled); return(messagingProvider.CreateMessageProcessor(_client.Value, _entityPath, processorOptions)); }); _sessionMessageProcessor = new Lazy <SessionMessageProcessor>( () => { var sessionProcessorOptions = options.ToSessionProcessorOptions(_autoCompleteMessages, concurrencyManager.Enabled); return(messagingProvider.CreateSessionMessageProcessor(_client.Value, _entityPath, sessionProcessorOptions)); }); _scaleMonitor = new Lazy <ServiceBusScaleMonitor>( () => new ServiceBusScaleMonitor( functionId, entityType, _entityPath, connection, _batchReceiver, loggerFactory, clientFactory)); if (concurrencyManager.Enabled) { _concurrencyUpdateManager = new ConcurrencyUpdateManager(concurrencyManager, _messageProcessor, _sessionMessageProcessor, _isSessionsEnabled, _functionId, _logger); } _singleDispatch = singleDispatch; _serviceBusOptions = options; _details = new Lazy <string>(() => $"namespace='{_client.Value?.FullyQualifiedNamespace}', enityPath='{_entityPath}', singleDispatch='{_singleDispatch}', " + $"isSessionsEnabled='{_isSessionsEnabled}', functionId='{_functionId}'"); }