diff --git a/rabbitmq.md b/rabbitmq.md index 1cbccd3..64b8046 100644 --- a/rabbitmq.md +++ b/rabbitmq.md @@ -1,14 +1,24 @@ 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$" \ @@ -17,7 +27,9 @@ rabbitmqctl set_policy \ "message-ttl":30000}' \ --apply-to queues + # DLQ policy: permanent dead letter storage + rabbitmqctl set_policy \ --vhost app_notifications \ dlq_policy "^notifications$" \