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); }
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)); }
private EventGridTopicEndpoint( EventSchema eventSchema, ServiceBusEventConsumerHost serviceBusEventConsumerHost, TestConfig config) { Guard.NotNull(serviceBusEventConsumerHost, nameof(serviceBusEventConsumerHost)); Guard.NotNull(config, nameof(config)); _eventSchema = eventSchema; _configuration = config; ServiceBusEventConsumerHost = serviceBusEventConsumerHost; }
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!"); } }