rabbitmqctl add_vhost app_notifications rabbitmqctl add_user backend-api-internal strongpassword rabbitmqctl set_user_tags backend-api-internal management rabbitmqctl set_permissions -p app_notifications backend-api-internal ".*" ".*" ".*" rabbitmqadmin declare exchange --vhost "app_notifications" --name "app_notifications" --type "topic" --durable "true" rabbitmqadmin declare queue --vhost "app_notifications" --name "notifications_retry" --durable "true" rabbitmqadmin declare queue --vhost "app_notifications" --name "notifications_dlq" --durable "true" rabbitmqadmin declare queue --vhost "app_notifications" --name "notifications" --durable "true" rabbitmqadmin declare binding --vhost "app_notifications" --source "app_notifications" --destination "notifications" --destination-type "queue" --routing-key "notify.#" # Retry policy: messages stay for 30s before going back to main queue rabbitmqctl set_policy \ --vhost app_notifications \ retry_policy "^notifications_retry$" \ '{"dead-letter-exchange":"app_notifications", "dead-letter-routing-key":"notify.retry", "message-ttl":30000}' \ --apply-to queues # DLQ policy: permanent dead letter storage rabbitmqctl set_policy \ --vhost app_notifications \ dlq_policy "^notifications$" \ '{"dead-letter-exchange":"app_notifications", "dead-letter-routing-key":"notify.dlq"}' \ --apply-to queues