Skip to content
Avery Wilkening edited this page Oct 15, 2019 · 15 revisions

If you have a queue configured as a FIFO Queue, Shoryuken will auto detect it, and just work ✨

How does that work?

If you send a message using perform_async or ActiveJob, Shoryuken will automatically set the Message Group ID to ShoryukenMessage and the Message Deduplication ID to a SHA-256 hash based on the message body.

If you want to set specific values to Message Group ID and Message Deduplication ID, you should use send_message instead:

MyWorker.perform_async(
  'body',
  message_group_id: 'id',
  message_deduplication_id: 'id'
)

Shoryuken::Client.queues('queue.fifo').send_message(
  message_body: 'body', 
  message_group_id: 'id', 
  message_deduplication_id: 'id'
)

Note: If you want to make sure that messages within the same Message Group ID get processed one at time, you will need to set concurrency: 1. Processing Groups can be a good alternative for that, in case we don't want to set concurrency: 1 for all queues.

Receiving messages

There's no special configuration needed to receive FIFO messages, you only need to configure the queue in the same way you would if it was a standard queue.

Process one by one

If you want to receive and process messages one by one for a Message Group, configure max_number_of_messages: 1 as follows:

Shoryuken.sqs_client_receive_message_opts = { 
  max_number_of_messages: 1 
}

See Receive Message options.