Logo: Relish

  1. Sign in

Project: Message-driver 0.7

Manual Message Acknowledgement

  • @bunny

This mode requires the consumer to call ack on the message in order to acknowledge it

Background
Given
I am connected to the broker
And
I have a destination :source_queue with no messages on it
Scenarios
Consuming Messages
Given
I have a message consumer
MessageDriver::Client.consumer(:my_consumer) do |message|
  message.ack
end
And
I create a subscription
MessageDriver::Client.subscribe(:source_queue, :my_consumer, ack: :manual)
When
I send the following messages to :source_queue
body
Test Message 1
Test Message 2
And
I let the subscription process
Then
I expect to find no messages on :source_queue
When a message is nack'ed
Given
I have a message consumer
MessageDriver::Client.consumer(:my_consumer) do |message|
  message.nack(requeue: true)
end
And
I create a subscription
MessageDriver::Client.subscribe(:source_queue, :my_consumer, ack: :manual)
When
I send the following messages to :source_queue
body
Test Message 1
Test Message 2
And
I let the subscription process
Then
I expect to find the following 2 messages on :source_queue
body
Test Message 1
Test Message 2
When an occurs before the message is ack'ed
Given
I have a message consumer
MessageDriver::Client.consumer(:my_consumer) do |message|
  raise "oh nos!"
  message.ack
end
And
I create a subscription
MessageDriver::Client.subscribe(:source_queue, :my_consumer, ack: :manual)
When
I send the following messages to :source_queue
body
Test Message 1
Test Message 2
And
I let the subscription process
Then
I expect to find the following 2 messages on :source_queue
body
Test Message 1
Test Message 2
When an error occurs after the message is ack'ed
Given
I have a message consumer
MessageDriver::Client.consumer(:my_consumer) do |message|
  message.ack
  raise "oh nos!"
end
And
I create a subscription
MessageDriver::Client.subscribe(:source_queue, :my_consumer, ack: :manual)
When
I send the following messages to :source_queue
body
Test Message 1
Test Message 2
And
I let the subscription process
Then
I expect to find no messages on :source_queue

Last published over 3 years ago by soupmatt.