Пример #1
0
        private void SchedulerWorkerCompleted(IResponderWorker worker, object state, IMessage responseMessage)
        {
            var senderReceiver = (SenderReceiver)state;
            var responseFrame  = _messageFrameCreator.CreateFromMessage(responseMessage);

            senderReceiver.Sender.WriteMessageFrame(responseFrame);
        }
Пример #2
0
        public void SendMessage(IMessage message)
        {
            var sendMessageFrame = _messageFrameCreator.CreateFromMessage(message);

            lock (_sendLock)
            {
                _messageFrameWriter.WriteMessageFrame(sendMessageFrame);
            }
        }
Пример #3
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();
            }
        }