Skip to content

Instantly share code, notes, and snippets.

@irfan-yusanif
Last active December 2, 2021 07:48
Show Gist options
  • Save irfan-yusanif/a7e27b0250b99fb6cfb87799dbfc3c71 to your computer and use it in GitHub Desktop.
Save irfan-yusanif/a7e27b0250b99fb6cfb87799dbfc3c71 to your computer and use it in GitHub Desktop.
Configure NserviceBus
class Program
{
static async Task Main(string[] args)
{
await CreateHostBuilder(args).RunConsoleAsync();
}
public static IHostBuilder CreateHostBuilder(string[] args)
{
return Host.CreateDefaultBuilder(args)
.UseNServiceBus(context =>
{
var endpointConfiguration = new EndpointConfiguration("Sales");
//configure transport - configure where your message will be published/saved
//you can configure it for RabbitMq, Azure Queue, Amazon SQS or any other cloud provider
endpointConfiguration.UseTransport<LearningTransport>();
endpointConfiguration.SendFailedMessagesTo("error"); //When a message fails processing it will be forwarded here.
endpointConfiguration.AuditProcessedMessagesTo("audit"); //All messages received by an endpoint will be forwarded to the audit queue.
return endpointConfiguration;
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment