public CommunicationViaRabbitMQSteps()
        {
            IntegrationTestHelper.SetUpFixture();

            
            _peerOne = new CommunicatingPeer("PeerOne");
            _peerTwo = new CommunicatingPeer("PeerTwo");
            _synchronizer = new CommunicationSynchronizer();

        }
Пример #2
0
 public void Unsubscribe(CommunicatingPeer peer, string topic)
 {
     peer.CommSvc2.Unsubscribe(new MessageDestination(topic));
 }
Пример #3
0
 public void Subscribe(CommunicatingPeer peer, string topic)
 {
     peer.CommSvc2.Subscribe(new MessageDestination(topic), 
         i => Receive(i, peer));
 }
Пример #4
0
 public void Receive(IIncomingMessage incomingMessage, CommunicatingPeer recipient)
 {
     Logger.Debug(this, "Handling incoming message...");
     lock (_syncRoot)
     {
         string incomingTopic = incomingMessage.Topic.ToString();
         HasMessageBeenReceived = true;
         ReceivedMessageTopic = incomingTopic;
         ReceivedMessage = incomingMessage.Content.ToString();
         ReceivedMsgCorrelationId = incomingMessage.CorrelationId;
         ReplyTo = incomingMessage.ReplyTo != null ? incomingMessage.ReplyTo.Address : String.Empty;
         Logger.Info(this, String.Format("{0} - Received message  on topic {1} from {2}",
             recipient.PeerName,
             incomingMessage.Topic.Address, incomingMessage.Sender));
         Monitor.Pulse(_syncRoot);
     }
 }
Пример #5
0
 public void Send(CommunicatingPeer peer, string topic, string content, string correlationId="whatever",
     Action<IIncomingMessage> responseHandler = null)
 {
     lock (_syncRoot)
     {
         peer.CommSvc2.Send(new MessageDestination(topic), 
             new MessageWrapper(content, correlationId),responseHandler);
         
         LastSentMessageTopic = topic;
         LastSentMessage = content;
         LastSentMsgCorrelationId = correlationId;
         
         Monitor.Wait(_syncRoot, 1000);
     }
 }