Ejemplo n.º 1
0
        public ServiceBusQueueDispatcher(
            IServiceBusClientFactory clientFactory)
        {
            if (clientFactory is null)
            {
                throw new ArgumentNullException(nameof(clientFactory));
            }

            _client = clientFactory.Build();
        }
Ejemplo n.º 2
0
 public ServiceBusService(
     IServiceBusClientFactory serviceBusClientFactory,
     IOptions <ServiceBusOptions> options,
     ITopicRepository topicRepository,
     ILogger <ServiceBusService> logger)
 {
     _managementClient  = serviceBusClientFactory.Build();
     _serviceBusOptions = options.Value;
     _topicRepository   = topicRepository ?? throw new ArgumentNullException(nameof(topicRepository));
     _logger            = logger ?? throw new ArgumentNullException(nameof(logger));
 }
        /// <summary>
        /// Create service bus event bus
        /// </summary>
        /// <param name="factory"></param>
        /// <param name="process"></param>
        /// <param name="logger"></param>
        public ServiceBusEventBus(IServiceBusClientFactory factory,
                                  ILogger logger, IProcessIdentity process = null)
        {
            _logger  = logger ?? throw new ArgumentNullException(nameof(logger));
            _factory = factory ?? throw new ArgumentNullException(nameof(factory));

            // TODO: If scaled out we need subscription ids for every instance!

            // Create subscription client
            _subscriptionClient = _factory.CreateOrGetSubscriptionClientAsync(
                ProcessEvent, ExceptionReceivedHandler, process?.ServiceId).Result;
            Try.Async(() => _subscriptionClient.RemoveRuleAsync(
                          RuleDescription.DefaultRuleName)).Wait();
        }
Ejemplo n.º 4
0
        public F1(
            IBasicAuthService basicAuthService,
            IBlobStorageClientFactory blobStorageClientFactory,
            IServiceBusClientFactory serviceBusClientFactory,
            IConfigurationRoot configuration,
            ILoggerFactory loggerFactory)
        {
            this.basicAuthService = basicAuthService;
            this.configuration    = configuration;

            this.blobStorageClient = blobStorageClientFactory.Create(
                new BlobStorageClientContext(
                    this.configuration["StorageConnectionString"],
                    this.configuration["StorageBlobContainerName"]));

            this.serviceBusClient = serviceBusClientFactory.Create(
                new ServiceBusClientContext(
                    this.configuration["ServiceBusConnectionString"],
                    this.configuration["ServiceBusQueueName"]));

            this.logger = loggerFactory.CreateLogger <F1>();
        }
Ejemplo n.º 5
0
 /// <summary>
 /// Create service client
 /// </summary>
 /// <param name="factory"></param>
 public ServiceBusQueueClient(IServiceBusClientFactory factory)
 {
     _factory = factory ?? throw new ArgumentNullException(nameof(factory));
 }