예제 #1
0
        public PipelineMessageReceiver(PipelineServiceBus bus, BaseMessageReceiverConfiguration config, BaseServiceBusConfig serviceBusConfig)
        {
            this.Bus  = bus;
            this.Name = Guid.NewGuid().ToString();

            this.ServiceLocator  = serviceBusConfig.ServiceLocator;
            this.MessageMapper   = serviceBusConfig.MessageMapper;
            this.MessageHandlers = config.GetCombinedMessageHandlers();
            this.compiledMessageHandlerPipeline = config.GetCompiledMessageHandlerPipeline();

            // initialize all known message types
            this.MessageMapper.Initialize(this.MessageHandlers.Select(x => x.HandledMessageType));

            this.Transport = config.CreateTransportReceiver();
            this.Transport.MessageAvailable      += (sender, args) => OnMessageAvailable(args);
            this.Transport.PoisonMessageDetected += (sender, args) => OnPoisonMessageDetected(args);
            this.startupActions.Add(() => this.Transport.Start());
        }
예제 #2
0
        public PipelineMessageReceiver(PipelineServiceBus bus, BaseMessageReceiverConfiguration config, BaseServiceBusConfig serviceBusConfig)
        {
            this.Bus = bus;
            this.Name = Guid.NewGuid().ToString();

            this.ServiceLocator = serviceBusConfig.ServiceLocator;
            this.MessageMapper = serviceBusConfig.MessageMapper;
            this.MessageHandlers = config.GetCombinedMessageHandlers();
            this.compiledMessageHandlerPipeline = config.GetCompiledMessageHandlerPipeline();

            // initialize all known message types
            this.MessageMapper.Initialize(this.MessageHandlers.Select(x => x.HandledMessageType));

            this.Transport = config.CreateTransportReceiver();
            this.Transport.MessageAvailable += (sender, args) => OnMessageAvailable(args);
            this.Transport.PoisonMessageDetected += (sender, args) => OnPoisonMessageDetected(args);
            this.startupActions.Add(() => this.Transport.Start());
        }