Update status on successful batch sent#23
Merged
Conversation
Simplify the calls to underlying database operations, we don't need the generic functions like execute_query. Refactor so that we call the underlying operation directly. Improve the test patching.
The underlying db PLSQL function is called get_next_batch but that does not describe what the OracleDatabase instance method returns. Amend to get_routing_plan_id as a routing plan ID is the return value.
We need to set a unique message reference for each recipient in our batch. The message reference will allow us to identify the status of each message in our batch. We also need to set a default message status of 'requested' and later a status of 'sent' once we have successfully sent the batch to the communication management API. This commit refactors the logic around getting recipients, assigning message references and message statuses and updating Oracle.
We retrieve and initialise Recipient instances from the OracleDatabase class, so use this type when forming requests to the Comunication Management API.
We delimit the api key and application ID with a period not a colon.
We should update the message status of each recipient in the batch if the request to Communication Management API was successful.
dnimmo
reviewed
Mar 17, 2025
| batch_id: str, | ||
| routing_config_id: str, | ||
| recipients: list[list[any]], | ||
| recipients: list[Recipient], |
dnimmo
approved these changes
Mar 17, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
There's a bit of noise in this PR due to refactoring and simplification. Best reviewed by commit.
Recipientinstancesget_next_batchas this function gets us a routing plan id.BCSSNotifyBatchProcessortoBatchProcessorREQUESTEDmessage status to recipient records in the Oraclemessage_queueview at the same time as their message reference is set.SENTmessage status to recipient records if the CM API batch message request is successful.