internal virtual Message RequestCorrelated(Message msg, TimeSpan timeout, IOutputChannel channel) { DateTime startTime = DateTime.Now; OutputChannel.Send(msg, timeout); return(((IDuplexChannel)channel).Receive(timeout - (DateTime.Now - startTime))); }
internal virtual Message RequestCorrelated(Message msg, TimeSpan timeout, IOutputChannel channel) { // FIXME: implement ConcurrencyMode check: // if it is .Single && this instance for a callback channel && the operation is invoked inside service operation, then error. DateTime startTime = DateTime.Now; OutputChannel.Send(msg, timeout); return(((IDuplexChannel)channel).Receive(timeout - (DateTime.Now - startTime))); }
internal void Send(Message msg, TimeSpan timeout) { if (OutputChannel != null) { OutputChannel.Send(msg, timeout); } else { RequestChannel.Request(msg, timeout); // and ignore returned message. } }
internal void Send(Message msg, TimeSpan timeout) { if (OutputChannel != null) { OutputChannel.Send(msg, timeout); } else { RequestChannel.Request(msg, timeout); } }
// They are internal for ClientBase<T>.ChannelBase use. internal Message Request(Message msg, TimeSpan timeout) { if (RequestChannel != null) { return(RequestChannel.Request(msg, timeout)); } else { DateTime startTime = DateTime.Now; OutputChannel.Send(msg, timeout); return(((IDuplexChannel)OutputChannel).Receive(timeout - (DateTime.Now - startTime))); } }
public void Send(Message message, TimeSpan timeout) { if (message == null) { throw new ArgumentNullException(nameof(message)); } WcfClientEventSource.Log.ChannelCalled(GetType().FullName, nameof(Send)); var telemetry = StartSendTelemetry(message, nameof(Send)); try { OutputChannel.Send(message, timeout); StopSendTelemetry(telemetry, null, null, nameof(Send)); } catch (Exception ex) { StopSendTelemetry(telemetry, null, ex, nameof(Send)); throw; } }
public void Send_Serializes_And_Sends_Message_To_Stream() { string message = "Another message"; byte[] expectedBytes = Encoding.UTF8.GetBytes(message); byte[] actualBytes = null; var stream = A.Fake<IOutputStream>(); A.CallTo(() => stream.Send(A<byte[]>._, A<int>._, A<int>._)).Invokes(foc => { var buffer = foc.GetArgument<byte[]>(0); var offset = foc.GetArgument<int>(1); var count = foc.GetArgument<int>(2); actualBytes = buffer.Skip(offset).Take(count).ToArray(); }); var channel = new OutputChannel<string>(stream, new StringSerializer(), 1024); channel.Send(message); CollectionAssert.AreEqual(expectedBytes, actualBytes); }
internal void Send(Message msg, TimeSpan timeout) { OutputChannel.Send(msg, timeout); }