public IBus Create() { var sqsConfig = new AmazonSQSConfig { RegionEndpoint = RegionEndpoint.APSoutheast2 }; var bus = Configure.With(new AutofacContainerAdapter(_lifetimeScope)) .Logging(l => l.Serilog(_logger)) .Transport( t => t.UseAmazonSqs("{AccessKey}", "{SecretKey}", sqsConfig, _inputQueueAddress)) .Routing(r => r.TypeBased().MapAssemblyOf <PoloEvent>(_inputQueueAddress)) .Options(o => { o.SetMaxParallelism(1); o.SetNumberOfWorkers(1); o.SimpleRetryStrategy(errorQueueAddress: _errorQueueAddress); //o.EnableUnitOfWork(Initiate, Commmit, Rollback); }) .Start(); bus.Subscribe <PoloEvent>(); return(bus); }
private void ConfigureBus() { var config = Rebus.Config.Configure.With(new NetCoreServiceCollectionContainerAdapter(Services)) .Logging(l => l.Trace()) .Routing(r => r.TypeBased() .MapAssemblyOf <CompanySaga>(Configuration["Rebus:QueueName"]) ) .Sagas(s => s.StoreInSqlServer(Configuration["Rebus:Sagas:ConnectionString"], Configuration["Rebus:Sagas:MessagesTableName"], Configuration["Rebus:Sagas:IndexesTableName"])); if (Environment.IsDevelopment() || Environment.IsOnPremises()) { config.Subscriptions(s => s.StoreInSqlServer(Configuration["Rebus:Subscriptions:ConnectionString"], Configuration["Rebus:Subscriptions:TableName"], isCentralized: true)); config.Transport(t => t.UseSqlServer(Configuration["Rebus:Transport:ConnectionString"], Configuration["Rebus:QueueName"])); } else if (Environment.IsAWS()) { var sqsConfig = new AmazonSQSConfig() { RegionEndpoint = Amazon.RegionEndpoint.GetBySystemName(Configuration["Rebus:Transport:RegionEndpoint"]) }; config.Transport(t => t.UseAmazonSQS(Configuration["Rebus:Transport:AccessKey"], Configuration["Rebus:Transport:SecretKey"], sqsConfig, Configuration["Rebus:Transport:QueueAddress"])); } else if (Environment.IsAzure()) { config.Transport(t => t.UseAzureServiceBus(Configuration["Rebus:Transport:ConnectionString"], Configuration["Rebus:QueueName"])); } else { throw new InvalidOperationException("Unknown execution environment"); } var bus = config.Start(); Services.AddSingleton(bus); Services.AddTransient <IEventDispatcher, RebusEventDispatcher>(); }
public override void Invoke(AWSCredentials creds, RegionEndpoint region, int maxItems) { AmazonSQSConfig config = new AmazonSQSConfig(); config.RegionEndpoint = region; ConfigureClient(config); AmazonSQSClient client = new AmazonSQSClient(creds, config); ListQueuesResponse resp = new ListQueuesResponse(); do { ListQueuesRequest req = new ListQueuesRequest { NextToken = resp.NextToken , MaxResults = maxItems }; resp = client.ListQueues(req); CheckError(resp.HttpStatusCode, "200"); foreach (var obj in resp.QueueUrls) { AddObject(obj); } }while (!string.IsNullOrEmpty(resp.NextToken)); }
public JobProcessor() { var sqsConfig = new AmazonSQSConfig(); sqsConfig.RegionEndpoint = bucketRegion; sqsClient = new AmazonSQSClient(sqsConfig); }
public async Task Yeas() { var gotTheString = new ManualResetEvent(false); var activator = new BuiltinHandlerActivator(); Using(activator); activator.Handle <string>(async str => gotTheString.Set()); Configure.With(activator) .Transport(t => { var config = new AmazonSQSConfig { RegionEndpoint = RegionEndpoint.EUWest2 }; t.UseAmazonSQS("queue", config); }) .Start(); await activator.Bus.SendLocal("HEJ MED DIG MIN VEN"); gotTheString.WaitOrDie(TimeSpan.FromSeconds(3), "Did not get the string within 3 s timeout"); }
public static AmazonSqsTransport CreateTransport(string inputQueueAddress, TimeSpan peeklockDuration, AmazonSQSTransportOptions options = null) { var connectionInfo = ConnectionInfo; var amazonSqsConfig = new AmazonSQSConfig { RegionEndpoint = connectionInfo.RegionEndpoint }; var consoleLoggerFactory = new ConsoleLoggerFactory(false); var credentials = new BasicAWSCredentials(connectionInfo.AccessKeyId, connectionInfo.SecretAccessKey); options ??= new AmazonSQSTransportOptions(); options.ClientFactory = () => new AmazonSQSClient(credentials, amazonSqsConfig); var transport = new AmazonSqsTransport( inputQueueAddress, consoleLoggerFactory, new TplAsyncTaskFactory(consoleLoggerFactory), options, new DefaultRebusTime() ); transport.Initialize(peeklockDuration); transport.Purge(); return(transport); }
private IAmazonSQS InitializeSQSClient() { var sqsConfig = new AmazonSQSConfig(); sqsConfig.ServiceURL = "http://localhost:9324"; return(new AmazonSQSClient(sqsConfig)); }
public static void Main() { #if RUN_LOCAL var config = new AmazonSQSConfig(); config.ServiceURL = "http://127.0.0.1:4100"; var sqs = new AmazonSQSClient(config); #else var chain = new CredentialProfileStoreChain(); // TODO: fill your credentials! if (!chain.TryGetAWSCredentials("DevDaysEurope2019", out var awsCredentials)) { Console.WriteLine("Can't find profile, configure profile and try again"); return; } var sqs = new AmazonSQSClient(awsCredentials, RegionEndpoint.EUCentral1); #endif var wrapper = new QueueWrapper(sqs); var queueUrl = wrapper.GetQueueUrl(QueueName).Result; Console.WriteLine($"Listening for messages, queue url: {queueUrl}"); do { var message = wrapper.GetNextMessage(queueUrl).Result; Console.WriteLine(message); Console.WriteLine("-----------------"); } while (true); }
/// <summary> /// encasulates the create connection logic /// </summary> /// <param name="config">configuration options</param> /// <returns>redis connection</returns> private ISqsConnection OnCreate(ISqsSettings config) { var sqsConfig = new AmazonSQSConfig { ////sqsConfig.Timeout = TimeSpan.FromSeconds(5); RegionEndpoint = RegionEndpoint.GetBySystemName(config.Region), }; var awsCreds = new BasicAWSCredentials(config.Username, config.Password); AmazonSQSClient?temp = null; try { temp = new AmazonSQSClient(awsCreds, sqsConfig); var connection = new SqsConnection(temp, config, this.Logger); temp = null; return(connection); } finally { temp?.Dispose(); } }
//Creates the client private static AmazonSQSClient createSQSClient() { var clientConfig = new AmazonSQSConfig(); clientConfig.ServiceURL = "https://sqs.us-east-1.amazonaws.com"; return(new AmazonSQSClient(clientConfig)); }
/// <summary> /// Create a client for the Amazon SQS Service with the specified configuration /// </summary> /// <param name="awsAccessKey">The AWS Access Key associated with the account</param> /// <param name="awsSecretAccessKey">The AWS Secret Access Key associated with the account</param> /// <param name="config">Configuration options for the service like HTTP Proxy, # of connections, etc /// </param> /// <returns>An Amazon SQS client</returns> /// <remarks> /// </remarks> public static IAmazonSQS CreateAmazonSQSClient( string awsAccessKey, string awsSecretAccessKey, AmazonSQSConfig config ) { return(new AmazonSQSClient(awsAccessKey, awsSecretAccessKey, config)); }
private int updateUrgency() { int currentUrgency = 0; var accessKey = "key"; var secretKey = "key"; var sqsConfig = new AmazonSQSConfig(); sqsConfig.ServiceURL = "http://sqs.us-east-1.amazonaws.com"; var sqsClient = new AmazonSQSClient(accessKey, secretKey, sqsConfig); var receiveMessageRequest = new ReceiveMessageRequest(); var queueUrl = "https://sqs.us-east-1.amazonaws.com/275098837840/InnovationShowdownButton5"; receiveMessageRequest.QueueUrl = queueUrl; var receiveMessageResponse = sqsClient.ReceiveMessage(receiveMessageRequest); var result = receiveMessageResponse.Messages; foreach (var message in result) { for (int i = 1; i <= 3; i++) { if (message.Body.Contains("urgency=" + i)) { currentUrgency = i; Console.Write(currentUrgency); } } var deleteMessageRequest = new DeleteMessageRequest(); deleteMessageRequest.QueueUrl = queueUrl; deleteMessageRequest.ReceiptHandle = message.ReceiptHandle; var response = sqsClient.DeleteMessage(deleteMessageRequest); } return(currentUrgency); }
static async Task MainAsync(IConfigurationRoot configuration) { var serviceUrl = configuration.GetConnectionString(""); var queueName = configuration.GetSection("").Value; var sqsConfig = new AmazonSQSConfig { ServiceURL = serviceUrl }; AmazonSQSClient sqsClient = new AmazonSQSClient(sqsConfig); var request = new CreateQueueRequest { QueueName = queueName, Attributes = new Dictionary <string, string> { { "ReceiveMessageWaitTimeSeconds", "20" }, } }; var createQueueResponse = await sqsClient.CreateQueueAsync(request); if (createQueueResponse.HttpStatusCode == HttpStatusCode.OK) { var setQueueAttributeRequest = new SetQueueAttributesRequest { Attributes = new Dictionary <string, string> { { "RedrivePolicy", @"{ ""deadLetterTargetArn"" : ""DEAD_LETTER_QUEUE_ARN"", ""maxReceiveCount"" : ""10""}" } }, QueueUrl = createQueueResponse.QueueUrl }; await sqsClient.SetQueueAttributesAsync(setQueueAttributeRequest); await ConsumeQueue(sqsClient, createQueueResponse.QueueUrl); } }
public SqsDispatcher(IOptions <SQSDispatcherOptions <T> > options, ISerializer serializer, ILogger <SqsDispatcher <T> > logger) : base(logger) { _serializer = serializer ?? throw new ArgumentNullException(nameof(serializer)); var config = options?.Value ?? throw new ArgumentNullException(nameof(options)); _queueUrl = config.QueueUrl ?? throw new Exception("No queue url set for type: " + (TypeCache <T> .FriendlyName ?? string.Empty)); var sqsConfig = new AmazonSQSConfig { ServiceURL = config.ServiceURL }; if (!string.IsNullOrEmpty(config.RegionEndpoint)) { sqsConfig.RegionEndpoint = RegionEndpoint.GetBySystemName(config.RegionEndpoint); } config.AwsDispatcherConfiguration?.Invoke(sqsConfig); _client = new AmazonSQSClient(sqsConfig); _contentType = new MessageAttributeValue { DataType = AttributeType, StringValue = _serializer.ContentType }; }
public Task StartAsync(CancellationToken cancellationToken) { _logger.LogInformation("Starting daemon: Email Logging. {Timer}", new { _config.Value.AwsSqsLongPollTimeInSeconds, _config.Value.WorkIntervalInSeconds, sentryEnabled = string.IsNullOrWhiteSpace(_config.Value.SentryDsn) ? false : true }); var sqsConfig = new AmazonSQSConfig { RegionEndpoint = RegionEndpoint.GetBySystemName(_config.Value.AwsSqsRegion) }; sqsConfig.RegionEndpoint = RegionEndpoint.USWest2; if (string.IsNullOrWhiteSpace(_config.Value.AwsSqsServiceUrl) == false) { sqsConfig.ServiceURL = _config.Value.AwsSqsServiceUrl; } if (string.IsNullOrWhiteSpace(_config.Value.AwsSqsSecretAccessKey) == false && string.IsNullOrWhiteSpace(_config.Value.AwsSqsAccessKeyId) == false) { _sqsClient = new AmazonSQSClient(_config.Value.AwsSqsAccessKeyId, _config.Value.AwsSqsSecretAccessKey, sqsConfig); } else { _sqsClient = new AmazonSQSClient(sqsConfig); } _timer = new Timer(DoWork, null, TimeSpan.Zero, TimeSpan.FromSeconds(_config.Value.WorkIntervalInSeconds)); return(Task.CompletedTask); }
public SQS_Consumer(AppConfig appConfig) { _awsConfig = appConfig; AmazonSQSConfig amazonSQSConfig = new AmazonSQSConfig(); try { var config = new AmazonSQSConfig() { RegionEndpoint = Amazon.RegionEndpoint.USEast1 //ServiceURL = "https://sqs.us-east-1.amazonaws.com/283124460764/NewProvisioning" // Region and URL }; //_messageRequest.QueueUrl = _appConfig.AwsQueueURL; var awsCredentials = new AwsCredentials(_awsConfig); _client = new AmazonSQSClient(awsCredentials, config); //Create object for DB Operations transactionRecord = new TransactionsRecord(awsCredentials); } catch (Exception ex) { } }
public string[] ListQueuename(string endpoint) { AmazonSQSConfig amazonSqsConfig = new AmazonSQSConfig { ServiceURL = endpoint }; AmazonSQSClient sqs = new AmazonSQSClient(amazonSqsConfig); int s = endpoint.Length + Program.MyAccountNumber.Length; int l = 0; //Confirming the queue exists var listQueuesRequest = new ListQueuesRequest(); var listQueuesResponse = sqs.ListQueues(listQueuesRequest); int size = listQueuesResponse.QueueUrls.Count; string[] queueCollection = new string[size]; //Console.WriteLine("Printing list of Amazon SQS queues.\n"); if (listQueuesResponse.QueueUrls != null) { int i = 0; foreach (String queueUrl in listQueuesResponse.QueueUrls) { l = queueUrl.Length; queueCollection[i] = queueUrl.Substring(s, l - s); i++; } } return(queueCollection); }
private static async Task Main(string[] args) { var SqsConfig = new AmazonSQSConfig { UseHttp = true, ServiceURL = "http://localhost:4566", }; //for localstack await Host.CreateDefaultBuilder(args) .ConfigureServices((hostContext, services) => { services.AddHostedService <ConsoleHostedService>(); // Automatically register all handlers from the assembly of a given type... services.AutoRegisterHandlersFromAssemblyOf <Program>(); //Configure Rebus services.AddRebus(configure => configure .Logging(l => l.ColoredConsole()) .Transport(t => t.UseAmazonSQSAsOneWayClient(SqsConfig)) //this is a send only endpoint .Routing(r => r.TypeBased().MapAssemblyOf <ImportantMessage>("ServerMessages"))); //Jobs services.AddSingleton <IJob, ProduceMessageJob>(); }) .RunConsoleAsync(); }
protected override async Task ExecuteAsync(CancellationToken stoppingToken) { var config = new AmazonSQSConfig(); config.ServiceURL = SERVICE_URL; using (var sqsClient = new AmazonSQSClient(config)) { while (!stoppingToken.IsCancellationRequested) { // _logger.LogInformation("Worker running at: {time}", DateTimeOffset.Now); var receiveRequest = new ReceiveMessageRequest(); receiveRequest.QueueUrl = QUEUE_URL; receiveRequest.MaxNumberOfMessages = 1; var receiveMessageResponse = await sqsClient.ReceiveMessageAsync(receiveRequest, stoppingToken); foreach (var message in receiveMessageResponse.Messages) { ProcessMessage(message); var deleteMessageRequest = new DeleteMessageRequest(); deleteMessageRequest.QueueUrl = QUEUE_URL; deleteMessageRequest.ReceiptHandle = message.ReceiptHandle; var response = await sqsClient.DeleteMessageAsync(deleteMessageRequest); } await Task.Delay(1000, stoppingToken); } } }
/// <summary> /// Create a new AmazonClient /// </summary> /// <param name="Credentials">Amazon Credentials for the connection to AWS</param> /// <param name="SqsConfig">SQS connection details</param> /// <param name="S3Config">S3 connection details</param> /// <param name="OutError">Out error, receives the error string if an error occurs</param> public AmazonClient(AWSCredentials Credentials, AmazonSQSConfig SqsConfig, AmazonS3Config S3Config, out string OutError) { OutError = string.Empty; if (SqsConfig != null) { try { SqsClient = new AmazonSQSClient(Credentials, SqsConfig); } catch (Exception Ex) { OutError += Ex.Message; } } if (S3Config != null) { try { S3Client = new AmazonS3Client(Credentials, S3Config); } catch (Exception Ex) { OutError += Ex.Message; } } }
public SqsSender(ILambdaLogger Logger) { logger = Logger; var awsCreds = new BasicAWSCredentials(AccessKey, SecretKey); var config = new AmazonSQSConfig { //RegionEndpoint = Amazon.RegionEndpoint.EUCentral1, ServiceURL = ServiceUrl }; var amazonSqsClient = new AmazonSQSClient(awsCreds, config); var listQueuesRequest = new ListQueuesRequest { QueueNamePrefix = "myQueue" }; if (!Task.Run <bool>(async() => await QueueExists(amazonSqsClient, QueueName)).Result) { CreateQueueResponse createQueueResponse = Task.Run <CreateQueueResponse>(async() => await CreateQueue(amazonSqsClient, QueueName)).Result; } if (!Task.Run <bool>(async() => await QueueExists(amazonSqsClient, QueueName)).Result) { logger.LogLine("QUEUE WAS NOT CREATED"); } }
public void Initialize(string consumerId, CancellationToken cancellationToken) { while (!cancellationToken.IsCancellationRequested) { try { _currentConsumerOptions = _options.Get(consumerId); var config = new AmazonSQSConfig { ServiceURL = _currentConsumerOptions.ServiceURL }; if (!string.IsNullOrEmpty(_currentConsumerOptions.RegionEndpoint)) { config.RegionEndpoint = RegionEndpoint.GetBySystemName(_currentConsumerOptions.RegionEndpoint); } _currentConsumerOptions.AwsConsumerConfiguration?.Invoke(config); _client = new AmazonSQSClient(config); _acknowledgementAction = msg => _client?.DeleteMessageAsync(msg.QueueUrl, msg.ReceiptHandle, default) ?? Task.CompletedTask; return; } catch (Exception e) { _logger.LogError(e, e.Message); if (!cancellationToken.IsCancellationRequested) { Thread.Sleep(TimeSpan.FromSeconds(2)); } } } }
public IBus GetBus <TMessage>(string inputQueueAddress, Func <TMessage, Task> handler) { var builtinHandlerActivator = new BuiltinHandlerActivator(); builtinHandlerActivator.Handle(handler); PurgeQueue(inputQueueAddress); var bus = Configure.With(builtinHandlerActivator) .Transport(t => { var info = AmazonSqsTransportFactory.ConnectionInfo; var amazonSqsConfig = new AmazonSQSConfig { RegionEndpoint = info.RegionEndpoint }; t.UseAmazonSQS(info.AccessKeyId, info.SecretAccessKey, amazonSqsConfig, inputQueueAddress); }) .Options(o => { o.SetNumberOfWorkers(10); o.SetMaxParallelism(10); }) .Start(); _stuffToDispose.Push(bus); return(bus); }
public JobService() { var sqsConfig = new AmazonSQSConfig(); sqsConfig.RegionEndpoint = bucketRegion; sqsClient = new AmazonSQSClient(sqsConfig); }
public bool Execute() { Console.WriteLine("Moving {0} messages from {1} to {2}", Count, SourceQueueName, DestinationQueueName); var config = new AmazonSQSConfig(); var client = new DefaultAwsClientFactory().GetSqsClient(config.RegionEndpoint); var sourceQueue = new SqsQueueByName(config.RegionEndpoint, SourceQueueName, client, JustSayingConstants.DEFAULT_HANDLER_RETRY_COUNT); var destinationQueue = new SqsQueueByName(config.RegionEndpoint, DestinationQueueName, client, JustSayingConstants.DEFAULT_HANDLER_RETRY_COUNT); var messages = PopMessagesFromSourceQueue(sourceQueue); var receiptHandles = messages.ToDictionary(m => m.MessageId, m => m.ReceiptHandle); var sendResponse = destinationQueue.Client.SendMessageBatch(new SendMessageBatchRequest { QueueUrl = destinationQueue.Url, Entries = messages.Select(x => new SendMessageBatchRequestEntry { Id = x.MessageId, MessageBody = x.Body }).ToList() }); var deleteResponse = sourceQueue.Client.DeleteMessageBatch(new DeleteMessageBatchRequest { QueueUrl = sourceQueue.Url, Entries = sendResponse.Successful.Select(x => new DeleteMessageBatchRequestEntry { Id = x.Id, ReceiptHandle = receiptHandles[x.Id] }).ToList() }); Console.WriteLine("Moved {0} messages from {1} to {2}", sendResponse.Successful.Count, SourceQueueName, DestinationQueueName); return(true); }
/// <summary> /// Constructor /// </summary> /// <param name="localizer"></param> /// <param name="settings"></param> /// <param name="logger"></param> public GoSMSQueueSender( IStringLocalizer <GoSMSQueueSender> localizer, IOptions <Model.Settings.GoSMSQueueConfiguration> settings, ILogger <GoSMSQueueSender> logger ) { if (localizer is null) { throw new ArgumentNullException(nameof(localizer)); } this.logger = logger ?? throw new ArgumentNullException(nameof(logger)); this.settings = settings ?? throw new ArgumentNullException(nameof(settings)); if (string.IsNullOrEmpty(settings.Value.QueueURL)) { throw new Exception(localizer["Invalid SMS endpoint"].Value); } var sqsConfig = new AmazonSQSConfig { RegionEndpoint = RegionEndpoint.GetBySystemName(settings.Value.Region) }; var awsCredentials = new Amazon.Runtime.BasicAWSCredentials(settings.Value.AccessKeyID, settings.Value.SecretAccessKey); amazonSQSClient = new AmazonSQSClient(awsCredentials, sqsConfig); }
/// <summary> /// Constructs the transport with the specified settings /// </summary> public AmazonSQSTransport(string inputQueueAddress, AWSCredentials credentials, AmazonSQSConfig amazonSqsConfig, IRebusLoggerFactory rebusLoggerFactory, IAsyncTaskFactory asyncTaskFactory, AmazonSQSTransportOptions options = null) { if (rebusLoggerFactory == null) { throw new ArgumentNullException(nameof(rebusLoggerFactory)); } _log = rebusLoggerFactory.GetLogger <AmazonSQSTransport>(); if (inputQueueAddress != null) { if (inputQueueAddress.Contains("/") && !Uri.IsWellFormedUriString(inputQueueAddress, UriKind.Absolute)) { var message = $"The input queue address '{inputQueueAddress}' is not valid - please either use a simple queue name (eg. 'my-queue') or a full URL for the queue endpoint (e.g. 'https://sqs.eu-central-1.amazonaws.com/234234234234234/somqueue')."; throw new ArgumentException(message, nameof(inputQueueAddress)); } } Address = inputQueueAddress; _credentials = credentials ?? throw new ArgumentNullException(nameof(credentials)); _amazonSqsConfig = amazonSqsConfig ?? throw new ArgumentNullException(nameof(amazonSqsConfig)); _asyncTaskFactory = asyncTaskFactory; _options = options ?? new AmazonSQSTransportOptions(); }
public SqsWorkProviderFactory( BasicAWSCredentials basicAwsCredentials, AmazonSQSConfig amazonSqsConfig) { _basicAwsCredentials = basicAwsCredentials; _amazonSqsConfig = amazonSqsConfig; }
static Func <IAmazonSQS> GetClientFactory(AWSCredentials credentials, AmazonSQSConfig config) { IAmazonSQS CreateClientFromCredentialsAndConfig() => new AmazonSQSClient(credentials, config); IAmazonSQS CreateClientFromCredentials() => new AmazonSQSClient(credentials); IAmazonSQS CreateClientFromConfig() => new AmazonSQSClient(config); IAmazonSQS CreateDefaultClient() => new AmazonSQSClient(); if (credentials != null && config != null) { return(CreateClientFromCredentialsAndConfig); } if (credentials != null) { return(CreateClientFromCredentials); } if (config != null) { return(CreateClientFromConfig); } return(CreateDefaultClient); }
public static async Task MainAsync() { Console.Title = "JasDev Sqs Saga"; #region ConfigureEndpoint var endpointConfiguration = new EndpointConfiguration("JasdevSqSimple"); var transport = endpointConfiguration.UseTransport <SqsTransport>(); //transport.S3("bucketname", "my/key/prefix"); var sqsConfig = new AmazonSQSConfig(); sqsConfig.ServiceURL = "http://sqs.us-west-1.amazonaws.com/"; sqsConfig.RegionEndpoint = RegionEndpoint.USWest1; var client = new AmazonSQSClient(sqsConfig); // transport.ClientFactory(() => client); #endregion endpointConfiguration.SendFailedMessagesTo("error"); endpointConfiguration.EnableInstallers(); endpointConfiguration.UsePersistence <InMemoryPersistence>(); var endpointInstance = await Endpoint.Start(endpointConfiguration) .ConfigureAwait(false); Console.WriteLine("Press any key to exit"); Console.ReadKey(); await endpointInstance.Stop() .ConfigureAwait(false); }