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)); }
public void Should_receive_the_request_message_type() { var responseChannel = new ChannelAdapter(); _channel.Request <Simple>(responseChannel); _received.IsCompleted.ShouldBeTrue("Message was not received"); }
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)); }
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)); }
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)); } } }