Allow access to computed SQS SendMessage parameters when using ActiveJob #651
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When enqueuing a message with ActiveJob, the SQS SendMessage parameters undergo several important transformations:
shoryuken_class
:message_attribute
is added:message_group_id
and:message_deduplication_id
are set for FIFO queues if those options were unspecifiedSince we store SQS SendMessage parameters on the ActiveJob job instance itself, they're accessible to the caller:
This change modifies the
sqs_send_message_parameters
reference to be the same object that's sent intoShoryuken::Queue#send_message
. That way, the caller has access to the complete set of computed SQSSendMessage parameters, not just the ones that were specified by the caller (for example, when using
.set
).This makes it possible, for instance, to log important information like the
message_deduplication_id
on the enqueuer side. It also gives important feedback to users so that they know exactly what parameters were sent to SQS.Related: #646