Ejemplo n.º 1
0
        public AzureClient(IAzureServiceBusPersistentConnection persistentConnection, ILifetimeScope lifeTimeScope, ISubscriptionManager subscriptionManager,
                           ILogger <AzureClient> logger, string subscriptionClientName, string exchangeName)
            : base(lifeTimeScope, subscriptionManager, logger, exchangeName)
        {
            _persistentConnection = persistentConnection;
            _subscriptionClient   = new SubscriptionClient(_persistentConnection.ServiceBusConnectionStringBuilder,
                                                           subscriptionClientName);

            RemoveDefaultRule();
            RegisterSubscriptionClientMessageHandler();
        }
        public AzureServiceBusClient(
            IAzureServiceBusPersistentConnection persistentConnection,
            ILogger <AzureServiceBusClient> logger)
        {
            _persistentConnection = Guard.Argument(persistentConnection, nameof(persistentConnection))
                                    .NotNull()
                                    .Value;

            _logger = Guard.Argument(logger, nameof(logger))
                      .NotNull()
                      .Value;
        }
Ejemplo n.º 3
0
        public AzureServiceBusSubscriptionClient(
            IAzureServiceBusPersistentConnection persistentConnection,
            ILogger <AzureServiceBusClient> logger,
            IOptions <AzureServiceBusSubscriptionConfiguration> configuration,
            IServiceProvider serviceProvider,
            IConfiguration globalConfiguration)
        {
            Guard.Argument(persistentConnection, nameof(persistentConnection)).NotNull();
            _serviceProvider = serviceProvider;

            _configuration = Guard.Argument(configuration, nameof(configuration)).NotNull().Value.Value;

            _logger = Guard.Argument(logger, nameof(logger)).NotNull().Value;

            _serviceProvider = Guard.Argument(serviceProvider, nameof(serviceProvider)).NotNull().Value;

            var subscriptionInfo = new AzureSubscriptionClientModel();

            globalConfiguration.Bind(typeof(TEvent).Name, subscriptionInfo);

            _subscriptionClient = persistentConnection.CreateSubscriptionClient(subscriptionInfo.TopicName, subscriptionInfo.SubscriptionName);
        }
        public AzureServiceBusEventBus(
            IServiceProvider provider,
            IAzureServiceBusPersistentConnection <ITopicClient> persitentConnection,
            string subscriptionName
            )
        {
            var loggerFactory = new LoggerFactory();

            _logger = loggerFactory.CreateLogger <AzureServiceBusEventBus>();

            _provider             = provider;
            _persistentConnection = persitentConnection;

            _evSubscriptionManager = new EventBusSubscriptionManager();
            _evSubscriptionManager.OnEventAdded   += OnEventAdded;
            _evSubscriptionManager.OnEventRemoved += OnEventRemoved;

            _subscriptionClient = new SubscriptionClient(persitentConnection.ConnectionStringBuilder, subscriptionName);
            _subscriptionClient.PrefetchCount = 300;

            RegisterMessageListener();
        }