Last active
October 9, 2021 21:31
-
-
Save ankitvijay/2e486b97c72f3de166ca1b304299c6a0 to your computer and use it in GitHub Desktop.
NServiceBus Cosmos Sample - Worker Host
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
await Host.CreateDefaultBuilder(args) | |
.UseNServiceBus((_ => | |
{ | |
var endpointConfiguration = new EndpointConfiguration("Samples.Worker"); | |
var transport = endpointConfiguration.UseTransport<LearningTransport>(); | |
transport.Transactions(TransportTransactionMode.SendsAtomicWithReceive); | |
endpointConfiguration.UsePersistence<CosmosPersistence>() | |
// Using Cosmos emulator | |
.CosmosClient(new CosmosClient( | |
"AccountEndpoint=https://localhost:8081/;AccountKey=C2y6yDjf5/R+ob0N8A7Cgv30VRDJIWEHLM+4QDU5DE2nQ9nDuVTqobD4b8mGGyPMbIZnqyMsEcaGQy67XIw/Jw==")) | |
.DatabaseName("Twitbook") | |
.DefaultContainer("Posts", "/PostId"); | |
endpointConfiguration.EnableOutbox(); | |
endpointConfiguration.Pipeline.Register(new PostIdAsPartitionKeyBehavior.Registration()); | |
endpointConfiguration.EnableInstallers(); | |
return endpointConfiguration; | |
})) | |
.Build() | |
.RunAsync(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment