Beispiel #1
0
        public UnsubscribeAction Connect(IInboundPipelineConfigurator configurator, object instance)
        {
            var worker = instance as ISagaWorker <TSaga>;
            ISagaMessageSink <TSaga, TMessage> sink = _connector.CreateSink();
            var workerSink = new SagaWorkerMessageSink <TSaga, TMessage>(worker, sink);

            return(configurator.Pipeline.ConnectToRouter(workerSink, () => configurator.SubscribedTo <Distributed <TMessage> >()));
        }
Beispiel #2
0
        public UnsubscribeAction Connect(IInboundPipelineConfigurator configurator, IWorker worker)
        {
            IWorkerLoad <TMessage> workerLoad = worker.GetWorkerLoad <TMessage>();

            ISagaPolicy <TSaga, TMessage> policy = GetPolicy();

            ISagaMessageSink <TSaga, TMessage> messageSink = GetSagaMessageSink(_sagaRepository, policy);

            var sink = new WorkerMessageSink <TMessage>(workerLoad, messageSink);

            return(configurator.Pipeline.ConnectToRouter(sink, () => configurator.SubscribedTo <Distributed <TMessage> >()));
        }
Beispiel #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 UnsubscribeAction Connect(IInboundPipelineConfigurator configurator)
        {
            ISagaMessageSink <TSaga, TMessage> sink = CreateSink();

            return(configurator.Pipeline.ConnectToRouter(sink, () => configurator.SubscribedTo <TMessage>()));
        }
 public SagaWorkerMessageSink(ISagaWorker <TSaga> worker, ISagaMessageSink <TSaga, TMessage> sink)
 {
     _worker = worker;
     _sink   = sink;
 }