Job A - Send a email:
Consumer is the email service that send a email to target
Job B - write to DB:
Consumer B update data from given model
when everything works, as usual is cool.
Chaos scenario: mail service error (whatever reason)
- a queue per destination (FIFO):
email service error, message stuck on the queue,
you can't update your DB because email messages are stuck
solution dead letter queue, stuck after x retry move to dead queue.
previous messages will go on
- a queue per message type:
email service error, message for emails are stuck,
DB is updating as usual
only emails are failing
think the work case to help you take most resilience choice
yes, "a queue per destination", less code, easier to scale workers ...
but in case of problem....
this solution will be done quickly (but start with dead letter queue)
(infra as code, less to do)
"a queue per message type" will reduce the failure
"a queue per message type" require more work at the beginning but will reduce
maintenance/manual work over time
and the code base will be easier to understand for next devs
(infra as code, more to do)
To finish think error case