public void SendMessage(IMessage message) { var sendMessageFrame = _messageFrameCreator.CreateFromMessage(message); lock (_sendLock) { _messageFrameWriter.WriteMessageFrame(sendMessageFrame); } }
private void SendMessageFrame(IMessageFrameWriter writer, MessageFrame messageFrame) { try { writer.WriteMessageFrame(messageFrame); } catch { if (_resentMessageFrames.TryAdd(messageFrame)) { Interlocked.Increment(ref _resentMessageFramesCount); } throw; } }
private void SendMessageFrame(IMessageFrameWriter writer, MessageFrame messageFrame) { try { writer.WriteMessageFrame(messageFrame); } catch { if (_resentMessageFrames.TryAdd(messageFrame)) { Interlocked.Increment(ref _resentMessageFramesCount); } throw; } }
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(); } }