예제 #1
0
        public void Establish()
        {
            _commandProcessor = new SpyCommandProcessor();
            _channel          = new FailingChannel {
                NumberOfRetries = 4
            };
            var mapper = new MyCommandMessageMapper();

            _messagePump = new MessagePump <MyCommand>(_commandProcessor, mapper)
            {
                Channel = _channel, TimeoutInMilliseconds = 5000, RequeueCount = -1
            };

            _command = new MyCommand();

            var message1 = new Message(new MessageHeader(Guid.NewGuid(), "MyTopic", MessageType.MT_COMMAND), new MessageBody(JsonConvert.SerializeObject(_command)));
            var message2 = new Message(new MessageHeader(Guid.NewGuid(), "MyTopic", MessageType.MT_COMMAND), new MessageBody(JsonConvert.SerializeObject(_command)));

            _channel.Add(message1);
            _channel.Add(message2);
            var quitMessage = new Message(new MessageHeader(Guid.Empty, "", MessageType.MT_QUIT), new MessageBody(""));

            _channel.Add(quitMessage);
        }
예제 #2
0
        public MessagePumpRetryEventConnectionFailureTests()
        {
            _commandProcessor = new SpyCommandProcessor();
            _channel          = new FailingChannel {
                NumberOfRetries = 4
            };
            var mapper = new MyEventMessageMapper();

            _messagePump = new MessagePump <MyEvent>(_commandProcessor, mapper)
            {
                Channel = _channel, TimeoutInMilliseconds = 5000, RequeueCount = -1
            };

            _event = new MyEvent();

            var message1 = new Message(new MessageHeader(Guid.NewGuid(), "MyTopic", MessageType.MT_EVENT), new MessageBody(JsonConvert.SerializeObject(_event)));
            var message2 = new Message(new MessageHeader(Guid.NewGuid(), "MyTopic", MessageType.MT_EVENT), new MessageBody(JsonConvert.SerializeObject(_event)));

            _channel.Add(message1);
            _channel.Add(message2);
            var quitMessage = new Message(new MessageHeader(Guid.Empty, "", MessageType.MT_QUIT), new MessageBody(""));

            _channel.Add(quitMessage);
        }