public OutgoingLogicalMessageContext(string messageId, Dictionary<string, string> headers, OutgoingLogicalMessage message, IReadOnlyCollection<RoutingStrategy> routingStrategies, IBehaviorContext parentContext) : base(messageId, headers, parentContext) { Message = message; RoutingStrategies = routingStrategies; Set(message); }
public OutgoingReplyContext(OutgoingLogicalMessage message, ReplyOptions options, IBehaviorContext parentContext) : base(options.MessageId, new Dictionary<string, string>(options.OutgoingHeaders), parentContext) { Message = message; Guard.AgainstNull(nameof(parentContext), parentContext); Guard.AgainstNull(nameof(message), message); Guard.AgainstNull(nameof(options), options); parentContext.Extensions.Merge(options.Context); }
/// <summary> /// Updates the message instance. /// </summary> public virtual void UpdateMessage(object newInstance) { Message = new OutgoingLogicalMessage(newInstance.GetType(), newInstance); }
/// <summary> /// Creates a <see cref="IOutgoingLogicalMessageContext" /> based on the current context. /// </summary> public static IOutgoingLogicalMessageContext CreateOutgoingLogicalMessageContext(this StageConnector <IOutgoingPublishContext, IOutgoingLogicalMessageContext> stageConnector, OutgoingLogicalMessage outgoingMessage, IReadOnlyCollection <RoutingStrategy> routingStrategies, IOutgoingPublishContext sourceContext) { Guard.AgainstNull(nameof(outgoingMessage), outgoingMessage); Guard.AgainstNull(nameof(routingStrategies), routingStrategies); Guard.AgainstNull(nameof(sourceContext), sourceContext); return(new OutgoingLogicalMessageContext( sourceContext.MessageId, sourceContext.Headers, outgoingMessage, routingStrategies, sourceContext)); }
public OutgoingLogicalMessageContext(string messageId, Dictionary <string, string> headers, OutgoingLogicalMessage message, IReadOnlyCollection <RoutingStrategy> routingStrategies, IBehaviorContext parentContext) : base(messageId, headers, parentContext) { Message = message; RoutingStrategies = routingStrategies; Set(message); }
public void UpdateMessage(object newInstance) { Guard.AgainstNull(nameof(newInstance), newInstance); Message = new OutgoingLogicalMessage(newInstance.GetType(), newInstance); }
private static string TryGetQueueName(OutgoingLogicalMessage logicalMessage) { return(logicalMessage.MessageType.FullName); }
public IEnumerable <RoutingStrategy> Route(Type messageType, IOutgoingContext context, OutgoingLogicalMessage outgoingMessage, DistributionStrategyScope distributionStrategyScope) { var routes = routeGenerator.GetRoutesFor(messageType); var matchingRoutes = routes.Where(r => r.Match(GetDestinationSites(context))); foreach (var destination in matchingRoutes) { var candidates = ResolveRoute(destination).ToArray(); var distributionContext = new DistributionContext(candidates, outgoingMessage, context.MessageId, context.Headers, resolveTransportAddress, context.Extensions); var distributionStrategy = distributionPolicy.GetDistributionStrategy(destination.ImmediateDestination, distributionStrategyScope); var selected = distributionStrategy.SelectDestination(distributionContext); var routingStrategy = new MapBasedRoutingStrategy(selected, destination.NextHop); yield return(routingStrategy); } }
public void UpdateMessage(object newInstance) { Guard.AgainstNull(nameof(newInstance), newInstance); Message = new OutgoingLogicalMessage(newInstance.GetType(), newInstance); }
/// <summary> /// Creates a <see cref="IOutgoingLogicalMessageContext" /> based on the current context. /// </summary> public static IOutgoingLogicalMessageContext CreateOutgoingLogicalMessageContext(this StageConnector<IOutgoingSendContext, IOutgoingLogicalMessageContext> stageConnector, OutgoingLogicalMessage outgoingMessage, IReadOnlyCollection<RoutingStrategy> routingStrategies, IOutgoingSendContext sourceContext) { Guard.AgainstNull(nameof(outgoingMessage), outgoingMessage); Guard.AgainstNull(nameof(routingStrategies), routingStrategies); Guard.AgainstNull(nameof(sourceContext), sourceContext); return new OutgoingLogicalMessageContext( sourceContext.MessageId, sourceContext.Headers, outgoingMessage, routingStrategies, sourceContext); }