Skip to content
Permalink

Comparing changes

This is a direct comparison between two commits made in this repository or its related repositories. View the default comparison for this range or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: alphagov/search-api
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 0793bed813abbc99283619b3cda1aef4bbfce0da
Choose a base ref
..
head repository: alphagov/search-api
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: fc880b0301a9439dc7dee21da6502ce2b3403e3a
Choose a head ref
Showing with 9 additions and 3 deletions.
  1. +9 −3 lib/retryable_queue_message.rb
12 changes: 9 additions & 3 deletions lib/retryable_queue_message.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
# This class should be used as a wrapper around GovukMessageQueueConsumer::Message
# whenever we use an exchange that uses a dead letter exchange (dlx) as a retry
# mechanism. Using a dlx in this way means sending counter intuitive responses to
# RabbitMQ. Where an ack is the approach to mark a job as completed AND to mark a
# job as failed, whereas discard actually signifies that we're going to retry the job.

# You should only use this class if you're planning to retry via a dlx otherwise
# it'll be very confusing!

class RetryableQueueMessage
delegate :payload, :headers, :status, :delivery_info, to: :queue_message

@@ -10,9 +19,6 @@ def done
end

def retry
# Some of our RabbitMQ exchanges are configured such that discarding a message
# pushes it to a queue to retry, so we have to a call an unintiuitvely named
# method totrigger a retry.
queue_message.discard
end