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 <ServiceBusEventConsumerHost> CreateServiceBusEventConsumerHostAsync(string topicName, string connectionString, ITestOutputHelper testOutput) { var serviceBusEventConsumerHostOptions = new ServiceBusEventConsumerHostOptions(topicName, connectionString); var testLogger = new XunitTestLogger(testOutput); var serviceBusEventGridEventConsumerHost = await ServiceBusEventConsumerHost.StartAsync(serviceBusEventConsumerHostOptions, testLogger); return(serviceBusEventGridEventConsumerHost); }
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!"); } }