Fix response message workflow instance correlation (#163)

* Add correlation id to workflow  response message

* Return message not correlating because of mismatching string formats
This commit is contained in:
Peter Davis 2019-11-16 17:59:05 +10:30 committed by Sipke Schoorstra
parent e3054b46c8
commit a7a192cb53
2 changed files with 4 additions and 2 deletions

View file

@ -36,7 +36,9 @@ namespace Sample08.Workflows
activity.ValueExpression = new JavaScriptExpression<object>("lastResult().Body");
}
)
.Then<Correlate>(activity => activity.ValueExpression = new LiteralExpression(Guid.NewGuid().ToString("N")))
// Need to ensure that the correlation ID is the same string format that is used by the WorkflowConsumer<T>
// MassTransit will always use Guid values for correlation ID's, so need to ensure the same string format is used.
.Then<Correlate>(activity => activity.ValueExpression = new LiteralExpression(Guid.NewGuid().ToString()))
.Then<SendMassTransitMessage>(activity =>
{
activity.Message = new JavaScriptExpression<CreateOrder>("return { correlationId: correlationId(), order: order};");

View file

@ -26,7 +26,7 @@ namespace Sample08.Workflows
.Then<TimerEvent>(activity => activity.TimeoutExpression = new LiteralExpression<TimeSpan>("00:00:05"))
.Then<SendMassTransitMessage>(activity =>
{
activity.Message = new JavaScriptExpression<OrderShipped>("return {order: order}");
activity.Message = new JavaScriptExpression<OrderShipped>("return { correlationId: correlationId(), order: order}");
activity.MessageType = typeof(OrderShipped);
}
);