Logo: Relish

  1. Sign in

Project: Message-driver 0.7

Automatic Message Acknowledgement

  • @bunny

This mode will ack the message if the consumer completes successfully.
It will nack the message if the consumer raises an error.

Background
Given
I am connected to the broker
And
I have a destination :dest_queue with no messages on it
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|
  MessageDriver::Client.publish(:dest_queue, message.body)
end
And
I create a subscription
MessageDriver::Client.subscribe(:source_queue, :my_consumer, ack: :auto)
When
I send the following messages to :source_queue
body
Auto Ack 1
Auto Ack 2
And
I let the subscription process
Then
I expect to find no messages on :source_queue
And
I expect to find the following 2 messages on :dest_queue
body
Auto Ack 1
Auto Ack 2
An error occurs during processing
Given
I have a message consumer
MessageDriver::Client.consumer(:my_consumer) do |message|
  raise "oh nos!"
end
And
I create a subscription
MessageDriver::Client.subscribe(:source_queue, :my_consumer, ack: :auto)
When
I send the following messages to :source_queue
body
Auto Ack Error 1
Auto Ack Error 2
And
I let the subscription process
Then
I expect to find no messages on :dest_queue
And
I expect to find the following 2 messages on :source_queue
body
Auto Ack Error 1
Auto Ack Error 2
A DontRequeue error occurs during processing
Given
I have a message consumer
MessageDriver::Client.consumer(:my_consumer) do |message|
  raise MessageDriver::DontRequeueError, "don't requeue me"
end
And
I create a subscription
MessageDriver::Client.subscribe(:source_queue, :my_consumer, ack: :auto)
When
I send the following messages to :source_queue
body
Auto Ack Error 1
Auto Ack Error 2
And
I let the subscription process
Then
I expect to find no messages on :dest_queue
And
I expect to find no messages on :source_queue

Last published about 3 years ago by soupmatt.