コード例 #1
0
        public TransportMessage CreateTransportMessage(string messageType, Stream serializedMessage, Action <TransportMessageConfigurator> configure)
        {
            Guard.AgainstNullOrEmptyString(messageType, "messageType");
            Guard.AgainstNull(serializedMessage, "serializedMessage");

            var transportMessagePipeline = _bus.Configuration.PipelineFactory.GetPipeline <TransportStreamPipeline>(_bus);

            var transportMessageConfigurator = new TransportMessageConfigurator(messageType, serializedMessage);

            if (_transportMessageReceived != null)
            {
                transportMessageConfigurator.TransportMessageReceived(_transportMessageReceived);
            }

            if (configure != null)
            {
                configure(transportMessageConfigurator);
            }

            if (!transportMessagePipeline.Execute(transportMessageConfigurator))
            {
                throw new PipelineException(string.Format(ESBResources.PipelineExecutionException, "TransportMessagePipeline",
                                                          transportMessagePipeline.Exception.AllMessages()));
            }

            return(transportMessagePipeline.State.GetTransportMessage());
        }
コード例 #2
0
        public TransportMessage CreateTransportMessage(object message, Action<TransportMessageConfigurator> configure)
        {
            Guard.AgainstNull(message, "message");

            var transportMessagePipeline = _bus.Configuration.PipelineFactory.GetPipeline<TransportMessagePipeline>(_bus);

            var transportMessageConfigurator = new TransportMessageConfigurator(message);

            if (_transportMessageReceived != null)
            {
                transportMessageConfigurator.TransportMessageReceived(_transportMessageReceived);
            }

            if (configure != null)
            {
                configure(transportMessageConfigurator);
            }

            if (!transportMessagePipeline.Execute(transportMessageConfigurator))
            {
                throw new PipelineException(string.Format(ESBResources.PipelineExecutionException, "TransportMessagePipeline",
                                                          transportMessagePipeline.Exception.AllMessages()));
            }

            return transportMessagePipeline.State.GetTransportMessage();
        }
コード例 #3
0
        public bool Execute(TransportMessageConfigurator configurator)
        {
            Guard.AgainstNull(configurator, "options");

            State.SetTransportMessageContext(configurator);

            return(base.Execute());
        }
コード例 #4
0
        public bool Execute(TransportMessageConfigurator configurator)
        {
            Guard.AgainstNull(configurator, "options");

            State.SetTransportMessageContext(configurator);

            return base.Execute();
        }
コード例 #5
0
		public static void SetTransportMessageContext(this State<Pipeline> state, TransportMessageConfigurator configurator)
		{
			state.Replace(StateKeys.TransportMessageConfigurator, configurator);
		}
コード例 #6
0
 public static void SetTransportMessageContext(this State<Pipeline> state, TransportMessageConfigurator configurator)
 {
     state.Replace(StateKeys.TransportMessageConfigurator, configurator);
 }