public IHttpActionResult Post(SendAcknowledgementCommand sendAcknowledgementCommand) { //write to db syncronously - async will not guarentee AcknowledgeCorrelatedMessages(sendAcknowledgementCommand); //using a different event here as the subscriber is already subscribing to the one above bus.Send( new CompleteAgreementSagaCommand() { CorrelationId = sendAcknowledgementCommand.CorrelationId }); return(Ok()); }
public IHttpActionResult Post(SendAcknowledgementCommand sendAcknowledgementCommand) { if (!sendAcknowledgementCommand.Success) { Console.WriteLine("received remote acknowledgment of failed insert. Log and send email"); return(Ok()); } //write to db syncronously - async will not guarentee completionService.CompleteCorrelatedMessages(sendAcknowledgementCommand.CorrelationId); //using a command as it is in a web thread bus.Send(new CompleteAgreementSagaCommand { CorrelationId = sendAcknowledgementCommand.CorrelationId }); return(Ok()); }