Example #1
0
 private static void CreateReplyContextFromHeaders(MessageBrokerContext messageContext, InboundBrokeredMessage inboundMessage)
 {
     if (inboundMessage.ApplicationProperties.TryGetValue(ApplicationProperties.ReplyToAddress, out var replyTo))
     {
         inboundMessage.ApplicationProperties.TryGetValue(ApplicationProperties.ReplyToGroupId, out var replyToSessionId);
         inboundMessage.ApplicationProperties.TryGetValue(ApplicationProperties.GroupId, out var groupId);
         replyToSessionId = !string.IsNullOrWhiteSpace((string)replyToSessionId) ? (string)replyToSessionId : (string)groupId;
         var replyContext = new ReplyToRoutingContext((string)replyTo, (string)replyToSessionId, messageContext.Container);
         messageContext.Container.Include(replyContext);
         inboundMessage.ClearReplyToProperties();
     }
 }
Example #2
0
 private void CreateCompensationContextFromHeaders(MessageBrokerContext messageContext, InboundBrokeredMessage inboundMessage)
 {
     if (!string.IsNullOrWhiteSpace(CompensateDestinationPath))
     {
         inboundMessage.ApplicationProperties.TryGetValue(ApplicationProperties.FailureDetails, out var detail);
         inboundMessage.ApplicationProperties.TryGetValue(ApplicationProperties.FailureDescription, out var description);
         var compensateContext = new CompensationRoutingContext(CompensateDestinationPath, (string)detail, (string)description, messageContext.Container);
         messageContext.Container.Include(compensateContext);
     }
 }
Example #3
0
 private static void CreateErrorContextFromHeaders(MessageBrokerContext messageContext, InboundBrokeredMessage inboundMessage)
 {
     if (inboundMessage.IsError)
     {
         inboundMessage.ApplicationProperties.TryGetValue(ApplicationProperties.FailureDetails, out var reason);
         inboundMessage.ApplicationProperties.TryGetValue(ApplicationProperties.FailureDescription, out var description);
         var errorContext = new ErrorContext((string)reason, (string)description);
         messageContext.SetFailure(errorContext);
     }
 }