public ServiceBusTriggerBinding(string parameterName, Type parameterType, ITriggerDataArgumentBinding <Message> argumentBinding, ServiceBusAccount account, ServiceBusOptions options, MessagingProvider messagingProvider, string queueName) : this(parameterName, parameterType, argumentBinding, account, options, messagingProvider) { _queueName = queueName; _entityPath = queueName; }
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 StringToServiceBusEntityConverter(ServiceBusAccount account, IBindableServiceBusPath defaultPath, EntityType entityType, MessagingProvider messagingProvider) { _account = account; _defaultPath = defaultPath; _entityType = entityType; _messagingProvider = messagingProvider; }
public ServiceBusTriggerAttributeBindingProvider(INameResolver nameResolver, ServiceBusOptions options, MessagingProvider messagingProvider, IConfiguration configuration) { _nameResolver = nameResolver ?? throw new ArgumentNullException(nameof(nameResolver)); _options = options ?? throw new ArgumentNullException(nameof(options)); _messagingProvider = messagingProvider ?? throw new ArgumentNullException(nameof(messagingProvider)); _configuration = configuration; }
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 ServiceBusQueueListenerFactory(ServiceBusAccount account, string queueName, ITriggeredFunctionExecutor executor, ServiceBusOptions options, MessagingProvider messagingProvider) { _account = account; _queueName = queueName; _executor = executor; _options = options; _messagingProvider = messagingProvider; }
public ServiceBusTriggerBinding(string parameterName, Type parameterType, ITriggerDataArgumentBinding <Message> argumentBinding, ServiceBusAccount account, ServiceBusOptions options, MessagingProvider messagingProvider, string topicName, string subscriptionName) : this(parameterName, parameterType, argumentBinding, account, options, messagingProvider) { _topicName = topicName; _subscriptionName = subscriptionName; _entityPath = EntityNameHelper.FormatSubscriptionPath(topicName, subscriptionName); }
public StringToServiceBusEntityConverter(ServiceBusAttribute attribute, IBindableServiceBusPath defaultPath, MessagingProvider messagingProvider, ServiceBusClientFactory clientFactory) { _attribute = attribute; _defaultPath = defaultPath; _entityType = _attribute.EntityType; _messagingProvider = messagingProvider; _clientFactory = clientFactory; }
public ServiceBusListener(string entityPath, ServiceBusTriggerExecutor triggerExecutor, ServiceBusConfiguration config) { _entityPath = entityPath; _triggerExecutor = triggerExecutor; _cancellationTokenSource = new CancellationTokenSource(); _messagingProvider = config.MessagingProvider; _messageProcessor = config.MessagingProvider.CreateMessageProcessor(entityPath); }
public ServiceBusAttributeBindingProvider( INameResolver nameResolver, MessagingProvider messagingProvider, ServiceBusClientFactory clientFactory) { _nameResolver = nameResolver ?? throw new ArgumentNullException(nameof(nameResolver)); _messagingProvider = messagingProvider ?? throw new ArgumentNullException(nameof(messagingProvider)); _clientFactory = clientFactory ?? throw new ArgumentNullException(nameof(clientFactory)); }
public ServiceBusListener(MessagingFactory messagingFactory, string entityPath, ServiceBusTriggerExecutor triggerExecutor, ServiceBusConfiguration config) { _messagingFactory = messagingFactory; _entityPath = entityPath; _triggerExecutor = triggerExecutor; _cancellationTokenSource = new CancellationTokenSource(); _messagingProvider = config.MessagingProvider; _messageProcessor = config.MessagingProvider.CreateMessageProcessor(entityPath); }
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 ServiceBusClientFactory( IConfiguration configuration, AzureComponentFactory componentFactory, MessagingProvider messagingProvider) { _configuration = configuration; _componentFactory = componentFactory; _messagingProvider = messagingProvider; }
public ServiceBusListenerFactory(ServiceBusAccount account, string entityPath, bool isSessionsEnabled, ITriggeredFunctionExecutor executor, ServiceBusOptions options, MessagingProvider messagingProvider) { _account = account; _entityPath = entityPath; _isSessionsEnabled = isSessionsEnabled; _executor = executor; _options = options; _messagingProvider = messagingProvider; }
public ServiceBusSubscriptionListenerFactory(ServiceBusAccount account, string topicName, string subscriptionName, ITriggeredFunctionExecutor executor, ServiceBusOptions options, MessagingProvider messagingProvider) { _account = account; _topicName = topicName; _subscriptionName = subscriptionName; _executor = executor; _options = options; _messagingProvider = messagingProvider; }
public ServiceBusBinding(string parameterName, IArgumentBinding <ServiceBusEntity> argumentBinding, ServiceBusAccount account, IBindableServiceBusPath path, ServiceBusAttribute attr, MessagingProvider messagingProvider) { _parameterName = parameterName; _argumentBinding = argumentBinding; _account = account; _path = path; _entityType = attr.EntityType; _messagingProvider = messagingProvider; _converter = new OutputConverter <string>(new StringToServiceBusEntityConverter(account, _path, _entityType, _messagingProvider)); }
public ServiceBusTriggerAttributeBindingProvider(INameResolver nameResolver, ServiceBusOptions options, MessagingProvider messagingProvider, IConfiguration configuration, ILoggerFactory loggerFactory, IConverterManager converterManager) { _nameResolver = nameResolver ?? throw new ArgumentNullException(nameof(nameResolver)); _options = options ?? throw new ArgumentNullException(nameof(options)); _messagingProvider = messagingProvider ?? throw new ArgumentNullException(nameof(messagingProvider)); _configuration = configuration; _loggerFactory = loggerFactory; _converterManager = converterManager; }
public ServiceBusTriggerBindingIntegrationTests() { IQueueTriggerArgumentBindingProvider provider = new UserTypeArgumentBindingProvider(); ParameterInfo pi = new StubParameterInfo("parameterName", typeof(UserDataType)); var argumentBinding = provider.TryCreate(pi); var options = new ServiceBusOptions(); var messagingProvider = new MessagingProvider(new OptionsWrapper <ServiceBusOptions>(options)); _queueBinding = new ServiceBusTriggerBinding("parameterName", typeof(UserDataType), argumentBinding, null, options, messagingProvider, "queueName"); _topicBinding = new ServiceBusTriggerBinding("parameterName", typeof(UserDataType), argumentBinding, null, options, messagingProvider, "subscriptionName", "topicName"); }
private ServiceBusTriggerBinding(string parameterName, Type parameterType, ITriggerDataArgumentBinding <Message> argumentBinding, ServiceBusAccount account, ServiceBusOptions options, MessagingProvider messagingProvider) { _parameterName = parameterName; _converter = CreateConverter(parameterType); _argumentBinding = argumentBinding; _bindingDataContract = CreateBindingDataContract(argumentBinding.BindingDataContract); _account = account; _options = options; _messagingProvider = messagingProvider; }
public ServiceBusClientFactory( IConfiguration configuration, AzureComponentFactory componentFactory, MessagingProvider messagingProvider, AzureEventSourceLogForwarder logForwarder) { _configuration = configuration; _componentFactory = componentFactory; _messagingProvider = messagingProvider; logForwarder.Start(); }
public MessagingProviderTests() { string defaultConnection = "Endpoint=sb://default.servicebus.windows.net/;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=abc123="; _config = new ServiceBusConfiguration { ConnectionString = defaultConnection }; _provider = new MessagingProvider(_config); string overrideConnection = "Endpoint=sb://override.servicebus.windows.net/;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=abc123="; Environment.SetEnvironmentVariable("AzureWebJobsServiceBusOverride", overrideConnection); }
/// <summary> /// Creates a new <see cref="ServiceBusExtensionConfigProvider"/> instance. /// </summary> /// <param name="options">The <see cref="ServiceBusOptions"></see> to use./></param> public ServiceBusExtensionConfigProvider(IOptions <ServiceBusOptions> options, MessagingProvider messagingProvider, INameResolver nameResolver, IConfiguration configuration, ILoggerFactory loggerFactory) { _options = options.Value; _messagingProvider = messagingProvider; _nameResolver = nameResolver; _configuration = configuration; _loggerFactory = loggerFactory ?? NullLoggerFactory.Instance; }
public ServiceBusTriggerBinding(string parameterName, Type parameterType, ITriggerDataArgumentBinding <Message> argumentBinding, ServiceBusAccount account, ServiceBusOptions options, MessagingProvider messagingProvider, string entityPath, bool isSessionsEnabled) { _parameterName = parameterName; _converter = CreateConverter(parameterType); _argumentBinding = argumentBinding; _bindingDataContract = CreateBindingDataContract(argumentBinding.BindingDataContract); _account = account; _options = options; _messagingProvider = messagingProvider; _entityPath = entityPath; _isSessionsEnabled = isSessionsEnabled; }
public ServiceBusClientFactory( IConfiguration configuration, AzureComponentFactory componentFactory, MessagingProvider messagingProvider, AzureEventSourceLogForwarder logForwarder, IOptions <ServiceBusOptions> options) { _configuration = configuration; _componentFactory = componentFactory; _messagingProvider = messagingProvider; _options = options?.Value ?? throw new ArgumentNullException(nameof(options)); logForwarder.Start(); }
public ServiceBusListenerFactory(ServiceBusAccount account, EntityType entityType, string entityPath, bool isSessionsEnabled, ITriggeredFunctionExecutor executor, FunctionDescriptor descriptor, ServiceBusOptions options, MessagingProvider messagingProvider, ILoggerFactory loggerFactory) { _account = account; _entityType = entityType; _entityPath = entityPath; _isSessionsEnabled = isSessionsEnabled; _executor = executor; _descriptor = descriptor; _options = options; _messagingProvider = messagingProvider; _loggerFactory = loggerFactory; }
public ServiceBusTriggerAttributeBindingProviderTests() { var configuration = ConfigurationUtilities.CreateConfiguration(new KeyValuePair <string, string>(Constants.DefaultConnectionStringName, "defaultConnection")); Mock <INameResolver> mockResolver = new Mock <INameResolver>(MockBehavior.Strict); ServiceBusOptions options = new ServiceBusOptions(); Mock <IConverterManager> convertManager = new Mock <IConverterManager>(MockBehavior.Default); var provider = new MessagingProvider(new OptionsWrapper <ServiceBusOptions>(options)); var factory = new ServiceBusClientFactory(configuration, new Mock <AzureComponentFactory>().Object, provider); _provider = new ServiceBusTriggerAttributeBindingProvider(mockResolver.Object, options, provider, NullLoggerFactory.Instance, convertManager.Object, factory); }
/// <summary> /// Creates a new <see cref="ServiceBusExtensionConfigProvider"/> instance. /// </summary> ///// <param name="options">The <see cref="ServiceBusOptions"></see> to use./></param> public ServiceBusExtensionConfigProvider( IOptions <ServiceBusOptions> options, MessagingProvider messagingProvider, INameResolver nameResolver, ILoggerFactory loggerFactory, IConverterManager converterManager, ServiceBusClientFactory clientFactory) { _options = options.Value; _messagingProvider = messagingProvider; _nameResolver = nameResolver; _loggerFactory = loggerFactory ?? NullLoggerFactory.Instance; _converterManager = converterManager; _clientFactory = clientFactory; }
public ServiceBusBinding( string parameterName, IArgumentBinding <ServiceBusEntity> argumentBinding, IBindableServiceBusPath path, ServiceBusAttribute attribute, MessagingProvider messagingProvider, ServiceBusClientFactory clientFactory) { _parameterName = parameterName; _argumentBinding = argumentBinding; _path = path; _messagingProvider = messagingProvider; _clientFactory = clientFactory; _attribute = attribute; _converter = new OutputConverter <string>(new StringToServiceBusEntityConverter(_attribute, _path, _messagingProvider, _clientFactory)); }
public ServiceBusTriggerAttributeBindingProvider( INameResolver nameResolver, ServiceBusOptions options, MessagingProvider messagingProvider, ILoggerFactory loggerFactory, IConverterManager converterManager, ServiceBusClientFactory clientFactory) { _nameResolver = nameResolver ?? throw new ArgumentNullException(nameof(nameResolver)); _options = options ?? throw new ArgumentNullException(nameof(options)); _messagingProvider = messagingProvider ?? throw new ArgumentNullException(nameof(messagingProvider)); _loggerFactory = loggerFactory; _converterManager = converterManager; _clientFactory = clientFactory; _logger = _loggerFactory.CreateLogger <ServiceBusTriggerAttributeBindingProvider>(); }
public void CreateMessageProcessor_ReturnsExpectedReceiver() { string defaultConnection = "Endpoint=sb://default.servicebus.windows.net/;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=abc123="; var config = new ServiceBusConfiguration { ConnectionString = defaultConnection }; var provider = new MessagingProvider(config); var receiver = provider.CreateMessageReceiver("entityPath", defaultConnection); Assert.Equal("entityPath", receiver.Path); config.PrefetchCount = 100; receiver = provider.CreateMessageReceiver("entityPath1", defaultConnection); Assert.Equal(100, receiver.PrefetchCount); }
public void CreateMessageSender_ReturnsExpectedSender() { string defaultConnection = "Endpoint=sb://default.servicebus.windows.net/;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=abc123="; var config = new ServiceBusConfiguration { ConnectionString = defaultConnection }; var provider = new MessagingProvider(config); var sender = provider.CreateMessageSender("entityPath", defaultConnection); Assert.Equal("entityPath", sender.Path); var sender2 = provider.CreateMessageSender("entityPath", defaultConnection); Assert.Same(sender, sender2); }