public override async Task Invoke(IOutgoingSendContext context, Func <Task> next) { OutgoingMessageOperation outgoingOperation; if (context.Headers.ContainsKey(Headers.IsSagaTimeoutMessage) && context.Headers[Headers.IsSagaTimeoutMessage] == bool.TrueString) { outgoingOperation = new RequestTimeoutOperation() { SagaId = context.Headers[Headers.SagaId], SagaTypeAssemblyQualifiedName = context.Headers[Headers.SagaType] }; } else { outgoingOperation = new SendOperation(); } outgoingOperation.SenderEndpoint = endpointName; outgoingOperation.MessageId = context.MessageId; outgoingOperation.MessageType = context.Message.MessageType; outgoingOperation.MessageInstance = context.Message.Instance; outgoingOperation.MessageHeaders = context.Headers; integrationContext.AddOutogingOperation(outgoingOperation); try { await next(); } catch (Exception sendError) { outgoingOperation.OperationError = sendError; throw; } }
public override async Task Invoke(IOutgoingReplyContext context, Func <Task> next) { var sendOperation = new ReplyOperation { SenderEndpoint = endpointName, MessageId = context.MessageId, MessageType = context.Message.MessageType, MessageInstance = context.Message.Instance, MessageHeaders = context.Headers }; integrationContext.AddOutogingOperation(sendOperation); try { await next(); } catch (Exception sendError) { sendOperation.OperationError = sendError; throw; } }