Ejemplo n.º 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());
        }
Ejemplo n.º 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();
        }
Ejemplo n.º 3
0
        public bool Execute(TransportMessageConfigurator configurator)
        {
            Guard.AgainstNull(configurator, "options");

            State.SetTransportMessageContext(configurator);

            return(base.Execute());
        }
        public bool Execute(TransportMessageConfigurator configurator)
        {
            Guard.AgainstNull(configurator, "options");

            State.SetTransportMessageContext(configurator);

            return base.Execute();
        }
		public static void SetTransportMessageContext(this State<Pipeline> state, TransportMessageConfigurator configurator)
		{
			state.Replace(StateKeys.TransportMessageConfigurator, configurator);
		}
 public static void SetTransportMessageContext(this State<Pipeline> state, TransportMessageConfigurator configurator)
 {
     state.Replace(StateKeys.TransportMessageConfigurator, configurator);
 }