ConversationId MyCustomConversationIdStrategy(ConversationIdStrategyContext context) { if (context.Message.Instance is MessageSentOutsideOfHandlerMatchingTheConvention message) { return(ConversationId.Custom($"{context.Headers[TennantIdHeaderKey]}-{message.MyBusinessId}")); } return(ConversationId.Default); }
public Receiver() { EndpointSetup <DefaultServer>( c => { c.ConfigureRouting() .RouteToEndpoint(typeof(AnyResponseMessage), typeof(Sender)); c.CustomConversationIdStrategy(ctx => ConversationId.Custom(GeneratedConversationId)); }); }
public void GlobalConvention() { EndpointConfiguration config = null; #region custom-conversation-id-convention config.CustomConversationIdStrategy(context => { if (context.Message.Instance is CancelOrder) { //use the order id as the conversation id return(ConversationId.Custom("Order/" + ((CancelOrder)context.Message.Instance).OrderId)); } //use the default generated id return(ConversationId.Default); }); #endregion }
public NewConversationEndpoint() { EndpointSetup <DefaultServer>(c => c.CustomConversationIdStrategy(ctx => ConversationId.Custom(GeneratedConversationId))); }
public void Should_not_allow_null_or_empty_conversation_id() { Assert.Throws <Exception>(() => Invoke(_ => ConversationId.Custom(null))); Assert.Throws <Exception>(() => Invoke(_ => ConversationId.Custom(""))); }