Beispiel #1
0
        public override void Send(Message message, TimeSpan timeout)
        {
            ThrowIfDisposedOrNotOpen();

            if (timeout <= TimeSpan.Zero)
            {
                throw new ArgumentException(String.Format("Timeout value must be positive value. It was {0}", timeout));
            }

            if (!is_service_side)
            {
                if (message.Headers.To == null)
                {
                    message.Headers.To = RemoteAddress.Uri;
                }
            }
            else
            {
                if (message.Headers.RelatesTo == null && OperationContext.Current.IncomingMessageHeaders != null)
                {
                    message.Headers.RelatesTo = OperationContext.Current.IncomingMessageHeaders.MessageId;
                }
            }

            client.SendTimeout = (int)timeout.TotalMilliseconds;
            frame.WriteSizedMessage(message);
        }