Ejemplo n.º 1
0
        public void SendMessage(IMessage message)
        {
            var sendMessageFrame = _messageFrameCreator.CreateFromMessage(message);

            lock (_sendLock)
            {
                _messageFrameWriter.WriteMessageFrame(sendMessageFrame);
            }
        }
Ejemplo n.º 2
0
 private void SendMessageFrame(IMessageFrameWriter writer, MessageFrame messageFrame)
 {
     try
     {
         writer.WriteMessageFrame(messageFrame);
     }
     catch
     {
         if (_resentMessageFrames.TryAdd(messageFrame))
         {
             Interlocked.Increment(ref _resentMessageFramesCount);
         }
         throw;
     }
 }
Ejemplo n.º 3
0
 private void SendMessageFrame(IMessageFrameWriter writer, MessageFrame messageFrame)
 {
     try
     {
         writer.WriteMessageFrame(messageFrame);
     }
     catch
     {
         if (_resentMessageFrames.TryAdd(messageFrame))
         {
             Interlocked.Increment(ref _resentMessageFramesCount);
         }
         throw;
     }
 }
Ejemplo n.º 4
0
        public IMessage Request(IMessage requestMessage)
        {
            var sendMessageFrame = _messageFrameCreator.CreateFromMessage(requestMessage);

            _semaphoreRequest.Wait(_cts.Token);
            try
            {
                _messageFrameWriter.WriteMessageFrame(sendMessageFrame);

                var messageFrame    = _messageFrameReceiver.Receive();
                var responseMessage = _messageSerialization.Deserialize(messageFrame.MessageTypeId, messageFrame.RawMessage);
                return(responseMessage);
            }
            finally
            {
                _semaphoreRequest.Release();
            }
        }