public async Task InitializeAsync()
        {
            var connectionString = Configuration.GetValue <string>("Arcus:Infra:ServiceBus:ConnectionString");
            var topicName        = Configuration.GetValue <string>("Arcus:Infra:ServiceBus:TopicName");

            var serviceBusEventConsumerHostOptions = new ServiceBusEventConsumerHostOptions(topicName, connectionString);

            _serviceBusEventConsumerHost = await ServiceBusEventConsumerHost.StartAsync(serviceBusEventConsumerHostOptions, Logger);
        }
Exemple #2
0
        private static async Task <EventGridTopicEndpoint> CreateAsync(EventSchema type, TestConfig config, ITestOutputHelper testOutput)
        {
            ServiceBusEventConsumerHost serviceBusEventConsumerHost =
                await CreateServiceBusEventConsumerHostAsync(
                    config.GetServiceBusTopicName(type),
                    config.GetServiceBusConnectionString(),
                    testOutput);

            return(new EventGridTopicEndpoint(type, serviceBusEventConsumerHost, config));
        }
Exemple #3
0
        private EventGridTopicEndpoint(
            EventSchema eventSchema,
            ServiceBusEventConsumerHost serviceBusEventConsumerHost,
            TestConfig config)
        {
            Guard.NotNull(serviceBusEventConsumerHost, nameof(serviceBusEventConsumerHost));
            Guard.NotNull(config, nameof(config));

            _eventSchema   = eventSchema;
            _configuration = config;
            ServiceBusEventConsumerHost = serviceBusEventConsumerHost;
        }
Exemple #4
0
        private async Task StartAsync()
        {
            if (_serviceBusEventConsumerHost is null)
            {
                var topicName        = _configuration.GetValue <string>("Arcus:Infra:ServiceBus:TopicName");
                var connectionString = _configuration.GetValue <string>("Arcus:Infra:ServiceBus:ConnectionString");
                var serviceBusEventConsumerHostOptions = new ServiceBusEventConsumerHostOptions(topicName, connectionString);

                _serviceBusEventConsumerHost = await ServiceBusEventConsumerHost.StartAsync(serviceBusEventConsumerHostOptions, _logger);
            }
            else
            {
                throw new InvalidOperationException("Service is already started!");
            }
        }