예제 #1
0
        public bool Inspect <TComponent, TMessage>(SelectedConsumerMessageSink <TComponent, TMessage> sink)
            where TMessage : class
            where TComponent : class, Consumes <TMessage> .Selected
        {
            Append(string.Format("Conditionally Consumed by Component {0} ({1})", GetComponentName <TComponent>(),
                                 GetMessageName <TMessage>()));

            return(true);
        }
        public UnsubscribeAction Connect(IInboundPipelineConfigurator configurator, IWorker worker)
        {
            IWorkerLoad <TMessage> workerLoad = worker.GetWorkerLoad <TMessage>();

            var consumerSink = new SelectedConsumerMessageSink <TConsumer, TMessage>(_consumerFactory);

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

            return(configurator.Pipeline.ConnectToRouter(sink, () => configurator.SubscribedTo <Distributed <TMessage> >()));
        }
예제 #3
0
        public bool Inspect <TComponent, TMessage>(SelectedConsumerMessageSink <TComponent, TMessage> sink)
            where TComponent : class, Consumes <TMessage> .Selected
            where TMessage : class
        {
            if (typeof(TMessage) == typeof(T))
            {
                Result = Result.Concat(new[] { sink as IPipelineSink <T> });

                return(false);
            }

            return(true);
        }
        public UnsubscribeAction Connect <T>(IInboundPipelineConfigurator configurator, IConsumerFactory <T> factory)
            where T : class
        {
            var consumerFactory = factory as IConsumerFactory <TConsumer>;

            if (consumerFactory == null)
            {
                throw new ArgumentException("The consumer factory is of an invalid type: " +
                                            typeof(T).ToShortTypeName());
            }

            var sink = new SelectedConsumerMessageSink <TConsumer, TMessage>(consumerFactory);

            return(configurator.Pipeline.ConnectToRouter(sink, () => configurator.SubscribedTo <TMessage>()));
        }