/// <summary> /// Setup rules to route the Scatter/Gather channel by inspecting the contents of the Scatter payload /// </summary> /// <typeparam name="TRequest"></typeparam> /// <typeparam name="TResponse"></typeparam> /// <param name="messageBus"></param> /// <param name="inTopic"></param> /// <param name="getTopic"></param> /// <returns></returns> public static IDisposable SetupScatterByExamination <TRequest, TResponse>(this IScatterGatherBus messageBus, string inTopic, Func <TRequest, string> getTopic) { Assert.ArgumentNotNull(messageBus, nameof(messageBus)); Assert.ArgumentNotNull(getTopic, nameof(getTopic)); var rule = new PayloadExamineRule <TRequest>(getTopic); return(messageBus.ScatterRouter.AddScatterRouteRule <TRequest, TResponse>(inTopic, rule)); }
/// <summary> /// Setup rules to route the Published message by inspecting the contents of the payload /// </summary> /// <typeparam name="TPayload"></typeparam> /// <param name="messageBus"></param> /// <param name="inTopics"></param> /// <param name="getTopic"></param> /// <returns></returns> public static IDisposable SetupPublishByExamination <TPayload>(this IPubSubBus messageBus, string[] inTopics, Func <TPayload, string> getTopic) { Assert.ArgumentNotNull(messageBus, nameof(messageBus)); Assert.ArgumentNotNull(getTopic, nameof(getTopic)); var rule = new PayloadExamineRule <TPayload>(getTopic); return(messageBus.PublishRouter.AddPublishRouteRule(inTopics, rule)); }