コード例 #1
0
        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)));
        }
コード例 #2
0
        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)));
        }
コード例 #3
0
 internal void Send(Message msg, TimeSpan timeout)
 {
     if (OutputChannel != null)
     {
         OutputChannel.Send(msg, timeout);
     }
     else
     {
         RequestChannel.Request(msg, timeout);                  // and ignore returned message.
     }
 }
コード例 #4
0
 internal void Send(Message msg, TimeSpan timeout)
 {
     if (OutputChannel != null)
     {
         OutputChannel.Send(msg, timeout);
     }
     else
     {
         RequestChannel.Request(msg, timeout);
     }
 }
コード例 #5
0
 // 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)));
     }
 }
コード例 #6
0
        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;
            }
        }
コード例 #7
0
ファイル: OutputChannelTests.cs プロジェクト: BuzzX8/Redcat
        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);
        }
コード例 #8
0
 internal void Send(Message msg, TimeSpan timeout)
 {
     OutputChannel.Send(msg, timeout);
 }