Exemplo n.º 1
0
        public static UnsubscribeAction ConnectToRouter <T>(this IMessagePipeline pipeline, IPipelineSink <T> sink, Func <UnsubscribeAction> subscribedTo)
            where T : class
        {
            UnsubscribeAction result = pipeline.ConnectToRouter(sink);

            UnsubscribeAction remove = subscribedTo();

            return(() => result() && remove());
        }
        public static UnsubscribeAction Subscribe <TMessage>(this IMessagePipeline pipeline, IEndpoint endpoint) where TMessage : class
        {
            var sink = new EndpointMessageSink <TMessage>(endpoint);

            return(pipeline.ConnectToRouter(sink));
        }