29 lines
1.5 KiB
Markdown
29 lines
1.5 KiB
Markdown
rabbitmqctl add_vhost app_notifications
|
|
rabbitmqctl add_user notifier strongpassword
|
|
rabbitmqctl set_user_tags notifier management
|
|
rabbitmqctl set_permissions -p app_notifications notifier ".*" ".*" ".*"
|
|
rabbitmqadmin --username "admin" --password "admin" declare exchange --vhost "app_notifications" --name "app_notifications" --type "topic" --durable "true"
|
|
rabbitmqadmin --username "admin" --password "admin" declare queue --vhost "app_notifications" --name "notifications_retry"
|
|
--durable "true"
|
|
rabbitmqadmin --username "admin" --password "admin" declare queue --vhost "app_notifications" --name "notifications_dlq"
|
|
--durable "true"
|
|
rabbitmqadmin --username "admin" --password "admin" declare queue --vhost "app_notifications" --name "notifications"
|
|
--durable "true"
|
|
rabbitmqadmin --username "admin" --password "admin" 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 |