Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
NServiceBus Cosmos Sample - AddPostHandler
public class AddPostHandler : IHandleMessages<AddPost>
public async Task Handle(AddPost message, IMessageHandlerContext context)
var cosmosSession = context.SynchronizedStorageSession.CosmosPersistenceSession();
var post = new Post(message.PostId, message.Title, message.Description, message.Author);
await context.Publish(new PostCreated
PostId = post.PostId,
Author = post.Author,
Description = post.Description,
Title = post.Title
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment