public static UnsubscribeAction Connect <TOutput>(this IInboundMessagePipeline pipeline,
                                                          IPipelineSink <IConsumeContext <TOutput> > sink)
            where TOutput : class
        {
            var routerConfigurator = new InboundMessageRouterConfigurator(pipeline);

            return(routerConfigurator.FindOrCreate <TOutput>().Connect(sink));
        }
        public UnsubscribeAction Connect(IInboundPipelineConfigurator configurator, HandlerSelector <TMessage> handler)
        {
            var routerConfigurator = new InboundMessageRouterConfigurator(configurator.Pipeline);

            MessageRouter <IConsumeContext <TMessage> > router = routerConfigurator.FindOrCreate <TMessage>();

            var sink = new InstanceMessageSink <TMessage>(MultipleHandlerSelector.ForHandler(handler));

            UnsubscribeAction result = router.Connect(sink);

            UnsubscribeAction remove = configurator.SubscribedTo <TMessage>();

            return(() => result() && (router.SinkCount == 0) && remove());
        }
Example #3
0
        public UnsubscribeAction Connect(IInboundPipelineConfigurator configurator)
        {
            var routerConfigurator = new InboundMessageRouterConfigurator(configurator.Pipeline);

            MessageRouter <IConsumeContext <TMessage> > router = routerConfigurator.FindOrCreate <TMessage>();

            ISagaMessageSink <TSaga, TMessage> sink = CreateSink();

            UnsubscribeAction result = router.Connect(sink);

            UnsubscribeAction remove = configurator.SubscribedTo <TMessage>();

            return(() => result() && (router.SinkCount == 0) && remove());
        }
        public static UnsubscribeAction ConnectToRouter <TOutput>(this IInboundMessagePipeline pipeline,
                                                                  IPipelineSink <IConsumeContext <TOutput> > sink,
                                                                  Func <UnsubscribeAction> subscribedTo)
            where TOutput : class
        {
            var routerConfigurator = new InboundMessageRouterConfigurator(pipeline);

            MessageRouter <IConsumeContext <TOutput> > router = routerConfigurator.FindOrCreate <TOutput>();

            UnsubscribeAction result = router.Connect(sink);

            UnsubscribeAction remove = subscribedTo();

            return(() => result() && (router.SinkCount == 0) && remove());
        }