Пример #1
0
        public static SentRequest <TRequest> Request <TRequest>(this UntypedChannel channel, Inbox inbox)
        {
            UntypedChannel responseChannel = inbox;

            Request <TRequest> sent = channel.Request <TRequest>(responseChannel);

            return(new SentRequestImpl <TRequest>(sent, inbox));
        }
Пример #2
0
        public void Should_receive_the_request_message_type()
        {
            var responseChannel = new ChannelAdapter();

            _channel.Request <Simple>(responseChannel);

            _received.IsCompleted.ShouldBeTrue("Message was not received");
        }
Пример #3
0
        public static SentRequest <TRequest> Request <TRequest>(this UntypedChannel channel, object values, Inbox inbox)
            where TRequest : class
        {
            UntypedChannel responseChannel = inbox;

            Request <TRequest> sent = channel.Request <TRequest>(values, responseChannel);

            return(new SentRequestImpl <TRequest>(sent, inbox));
        }
Пример #4
0
        public static SentRequest <TRequest> Request <TRequest>(this UntypedChannel channel, object values,
                                                                Action <SetMessageHeader> messageCallback, Inbox inbox)
            where TRequest : class
        {
            UntypedChannel responseChannel = inbox;

            Request <TRequest> sent = channel.Request <TRequest>(values, messageCallback, responseChannel);

            return(new SentRequestImpl <TRequest>(sent, inbox));
        }
Пример #5
0
        public static bool SendRequestWaitForResponse <TRequest>(this UntypedChannel channel, TimeSpan timeout)
        {
            using (var reset = new ManualResetEvent(false))
            {
                var responseChannel = new ChannelAdapter();
                using (responseChannel.Connect(x =>
                {
                    x.AddConsumerOf <Response <TRequest> >()
                    .UsingConsumer(m => reset.Set())
                    .HandleOnCallingThread();
                }))
                {
                    channel.Request <TRequest>(responseChannel);

                    return(reset.WaitOne(timeout, true));
                }
            }
        }