Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add dead letter exchanges and queues to rabbitmq #1834

Merged
merged 2 commits into from
Jul 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions terraform/projects/app-publishing-amazonmq/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,15 @@ It uses remote state from the infra-vpc and infra-security-groups modules.
The Terraform provider will only allow us to create a single user, so all
other users must be added from the RabbitMQ web admin UI or REST API.

We set a dead letter exchange for the govuk_chat_published_documents called govuk_chat_retry_dlx
This dlx then send all incoming messages to a queue called govuk_chat_retry.
this queue has a message-ttl value set and a dead letter exchange set to an exchange called govuk_chat_dlx.
This last exchange route all incoming messages back to govuk_chat_published_documents.

The result of all this is that when a message is rejected in govuk_chat_published_documents,
it ends up in the govuk_chat_retry queue, it will then wait here for the message-ttl value before expiring.
After expiration it is sent back to govuk_chat_published_documents.

## Requirements

| Name | Version |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,31 @@
},
"priority": 0
},
{
"vhost": "publishing",
"name": "govuk_chat_retry_dlx",
"pattern": "govuk_chat_published_documents",
"apply-to": "queues",
"definition": {
"dead-letter-exchange": "govuk_chat_retry_dlx",
"ha-mode": "all",
"ha-sync-mode": "automatic"
},
"priority": 0
},
{
"vhost": "publishing",
"name": "govuk_chat_retry",
"pattern": "govuk_chat_retry",
"apply-to": "queues",
"definition": {
"dead-letter-exchange": "govuk_chat_dlx",
"message-ttl":"${govuk_chat_retry_message-ttl}",
"ha-mode": "all",
"ha-sync-mode": "automatic"
},
"priority": 0
},
{
"vhost": "publishing",
"name": "ha-all",
Expand Down Expand Up @@ -210,6 +235,13 @@
"auto_delete": false,
"arguments": {}
},
{
"name": "govuk_chat_retry",
"vhost": "publishing",
"durable": true,
"auto_delete": false,
"arguments": {}
},
{
"name": "email_unpublishing",
"vhost": "publishing",
Expand All @@ -228,6 +260,24 @@
"internal": false,
"arguments": {}
},
{
"name": "govuk_chat_retry_dlx",
"vhost": "publishing",
"type": "topic",
"durable": true,
"auto_delete": false,
"internal": false,
"arguments": {}
},
{
"name": "govuk_chat_dlx",
"vhost": "publishing",
"type": "topic",
"durable": true,
"auto_delete": false,
"internal": false,
"arguments": {}
},
{
"name": "content_data_api_dlx",
"vhost": "publishing",
Expand Down Expand Up @@ -414,6 +464,22 @@
"destination_type": "queue",
"routing_key": "*.unpublish.#",
"arguments": {}
},
{
"source": "govuk_chat_retry_dlx",
"vhost": "publishing",
"destination": "govuk_chat_retry",
"destination_type": "queue",
"routing_key": "#",
"arguments": {}
},
{
"source": "govuk_chat_dlx",
"vhost": "publishing",
"destination": "govuk_chat_published_documents",
"destination_type": "queue",
"routing_key": "#",
"arguments": {}
}
]
}
6 changes: 6 additions & 0 deletions terraform/projects/app-publishing-amazonmq/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,12 @@ variable "publishing_amazonmq_broker_name" {
default = "PublishingMQ"
}

variable "govuk_chat_retry_message-ttl" {
type = string
description = "Time in miliseconds before messages in the govuk_chat_retry queue expires and are sent back to the govuk_chat_published_ducoments queue through the dead letter mechanism"
default = "300000"
}

variable "elb_internal_certname" {
type = string
description = "The ACM cert domain name to find the ARN of, so that it can be applied to the Network Load Balancer"
Expand Down
Loading