private void SchedulerWorkerCompleted(IResponderWorker worker, object state, IMessage responseMessage) { var senderReceiver = (SenderReceiver)state; var responseFrame = _messageFrameCreator.CreateFromMessage(responseMessage); senderReceiver.Sender.WriteMessageFrame(responseFrame); }
public void SendMessage(IMessage message) { var sendMessageFrame = _messageFrameCreator.CreateFromMessage(message); lock (_sendLock) { _messageFrameWriter.WriteMessageFrame(sendMessageFrame); } }
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(); } }