Skip to content

New: [AEA-5308] - Add NHS Notify callback lambda#1634

Merged
anthony-nhs merged 289 commits intomainfrom
aea-5308-notify-callback
Jun 5, 2025
Merged

New: [AEA-5308] - Add NHS Notify callback lambda#1634
anthony-nhs merged 289 commits intomainfrom
aea-5308-notify-callback

Conversation

@wildjames
Copy link
Copy Markdown
Contributor

Summary

  • ✨ New Feature

Details

Adds a lambda function which receives callback notification updates, and stores them in the relevant dynamo table

…igital/eps-prescription-status-update-api into aea-5199-setup-notifications-lambda
…igital/eps-prescription-status-update-api into aea-5199-setup-notifications-lambda
@kris-szlapa
Copy link
Copy Markdown

There are currently hardcoded values such as 100 for the SQS batch size and 900 for the cooldown period.
For better readability and maintainability, you might consider moving these values to named constants at the top of the file, or loading them from environment variables if they could change between environments.
Of course, feel free to keep them as-is if that’s preferable for your use case.

Comment thread packages/nhsNotifyLambda/src/utils.ts Outdated
)

const parsedMessages: Array<PSUDataItemMessage> = Messages.map((m) => {
const parsedMessages: Array<NotifyDataItemMessage> = Messages.map((m) => {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The current logic in drainQueue will throw and abort processing if any SQS message in the batch is malformed (for example, if a message is missing a Body, has invalid JSON, or does not match the expected structure). This means that a single bad message will prevent all other messages in that batch from being processed, which is an explicit design choice.

If this is intentional (for example, to avoid partial processing or to surface bad upstream producers quickly), this behavior is correct. However, if we ever want to make the function more resilient - so that only invalid messages are skipped and valid ones continue processing - we would need to refactor this logic, possibly by adding per-message validation and error handling.

For now, as long as the intended policy is to reject the whole batch on any error, this approach is consistent with that goal. If requirements change, we can revisit this for more granular handling.

@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented Jun 5, 2025

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.

3 participants