Skip to content

Stop sending emails to ACS when ACS returns 429 (rate-limit handling) #1172

@Ahmed-Ghanam

Description

@Ahmed-Ghanam

Description

The Altinn Notifications Email service reads messages from the Kafka topic altinn.notifications.email.queue and forwards them to Azure Communication Services (ACS) for email delivery. ACS enforces rate limits and returns HTTP 429 Too Many Requests when those limits are exceeded. Currently, the email service continues attempting to send messages even after receiving the first 429 response. This leads to unnecessary retries and can result in delays exceeding one hour.

Expected Behavior

  • When the service receives a 429 response from ACS:
    • Temporarily stop sending further emails.
    • Return messages to the Altinn Notifications API to update their status.

Acceptance Criteria

  • Email service stops sending to ACS immediately after a 429 response.
  • Altinn Notifications API updates the single row in the notifications.resourcelimitlog table with the next valid sending date and time.
  • Messages are handed back to the Altinn Notifications API.
  • Altinn Notifications API updates the status of those messages back to New from Sending.
  • Altinn Notifications API resumes sending only after the retry interval.
  • Unit/integration tests added to verify throttling behavior.
  • Clear logs and metrics published for observability.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    Status

    📈 Accepted for clarification & planning

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions