public void When_requeing_a_failed_message() { //Need to receive to subscribe to feed, before we send a message. This returns an empty message we discard _messageConsumer.Receive(1000); //Send a sequence of messages, we want to check that ordering is preserved _messageProducer.Send(_messageOne); _messageProducer.Send(_messageTwo); //Now receive, the first message var sentMessageOne = _messageConsumer.Receive(30000); //now requeue the first message _messageConsumer.Requeue(_messageOne, 300); //try receiving again; messageTwo should come first var sentMessageTwo = _messageConsumer.Receive(30000); var messageBodyTwo = sentMessageTwo.Body.Value; _messageConsumer.Acknowledge(sentMessageTwo); sentMessageOne = _messageConsumer.Receive(3000); var messageBodyOne = sentMessageOne.Body.Value; _messageConsumer.Acknowledge(sentMessageOne); //_should_send_a_message_via_restms_with_the_matching_body messageBodyOne.Should().Be(_messageOne.Body.Value); messageBodyTwo.Should().Be(_messageTwo.Body.Value); }
public void When_posting_a_message_via_the_messaging_gateway() { //Need to receive to subscribe to feed, before we send a message. This returns an empty message we discard _messageConsumer.Receive(1000); //Send a sequence of messages, we want to check that ordering is preserved _messageProducer.Send(_messageOne); _messageProducer.Send(_messageTwo); //Now receive, and confirm order off is order on var sentMessageOne = _messageConsumer.Receive(30000); var sentMessageTwo = _messageConsumer.Receive(30000); //clear up messages that we have received var messageBodyOne = sentMessageOne.Body.Value; _messageConsumer.Acknowledge(sentMessageOne); var messageBodyTwo = sentMessageTwo.Body.Value; _messageConsumer.Acknowledge(sentMessageTwo); //_should_send_a_message_via_restms_with_the_matching_body messageBodyOne.Should().Be(_messageOne.Body.Value); messageBodyTwo.Should().Be(_messageTwo.Body.Value); }
public void When_posting_a_message_via_the_messaging_gateway() { _messageConsumer.Receive(30000); //Need to receive to subscribe to feed, before we send a message. This returns an empty message we discard _messageProducer.Send(_message); var sentMessage = _messageConsumer.Receive(30000); var messageBody = sentMessage.Body.Value; _messageConsumer.Acknowledge(sentMessage); //_should_send_a_message_via_restms_with_the_matching_body messageBody.Should().Be(_message.Body.Value); }
public void When_requeing_a_failed_message_with_delay() { //clear the queue, and ensure it exists _messageConsumer.Receive(1000); //send & receive a message _messageProducer.Send(_messageOne); var message = _messageConsumer.Receive(3000); message.Header.HandledCount.Should().Be(0); message.Header.DelayedMilliseconds.Should().Be(0); //now requeue with a delay _messageConsumer.Requeue(_messageOne, 1000); //receive and assert message = _messageConsumer.Receive(3000); message.Header.HandledCount.Should().Be(1); message.Header.DelayedMilliseconds.Should().Be(1000); }