Created
August 20, 2021 14:30
-
-
Save jeremydmiller/175f7676f2e21191342d3fabfa1388c0 to your computer and use it in GitHub Desktop.
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
public class ShowHandler_CreateItemCommand : Jasper.Bus.Model.MessageHandler | |
{ | |
private readonly IDocumentStore _documentStore; | |
public ShowHandler_CreateItemCommand(IDocumentStore documentStore) | |
{ | |
_documentStore = documentStore; | |
} | |
public override async Task Handle(Jasper.Bus.Runtime.Invocation.IInvocationContext context) | |
{ | |
var createItemCommand = (ShowHandler.CreateItemCommand)context.Envelope.Message; | |
// generated by middleware | |
using (var documentSession = _documentStore.OpenSession()) | |
{ | |
// calling the inner "handler" | |
var outgoing1 = ShowHandler.CreateItemHandler.Handle(createItemCommand, documentSession); | |
// generated by standard policies to glue together outgoing messages | |
context.EnqueueCascading(outgoing1); | |
// this was generated by transactional middleware | |
await documentSession.SaveChangesAsync(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The actual handler code is this: