Skip to content

Update status on successful batch sent#23

Merged
steventux merged 10 commits intomainfrom
update-status-on-successful-batch-sent
Mar 17, 2025
Merged

Update status on successful batch sent#23
steventux merged 10 commits intomainfrom
update-status-on-successful-batch-sent

Conversation

@steventux
Copy link
Contributor

@steventux steventux commented Mar 17, 2025

There's a bit of noise in this PR due to refactoring and simplification. Best reviewed by commit.

  • Renames the term "participant" to "recipient" for consistency.
  • Refactors generic yet single use calls to underlying oracledb operations. We may as well keep them simple.
  • Refactors how we fetch recipients so that their message reference is also assigned and they are returned as convenient Recipient instances
  • Renames get_next_batch as this function gets us a routing plan id.
  • Renames BCSSNotifyBatchProcessor to BatchProcessor
  • Assigns REQUESTED message status to recipient records in the Oracle message_queue view at the same time as their message reference is set.
  • Assigns SENT message status to recipient records if the CM API batch message request is successful.

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.
batch_id: str,
routing_config_id: str,
recipients: list[list[any]],
recipients: list[Recipient],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❤️

@steventux steventux added this pull request to the merge queue Mar 17, 2025
Merged via the queue into main with commit 6a23c1c Mar 17, 2025
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants