DEV Community

Discussion on: Transactional Outbox Pattern in a monolithic application

Collapse
 
marceloavan profile image
Marcelo Avancini

Great article, congrats!

Just a question: do you have some extra care about handling recurring errors during the message pick and dispatch to the spring event? I mean to avoid some error looping with the same message.

Collapse
 
maciejtoporowicz profile image
Maciej Toporowicz

Thank you!

You're right, this code assumes the message always gets published successfully.

You'd need to have a dead letter queue in place. To my mind it'd be best not to implement it yourself , but use a message queue like RabbitMQ to handle it.

Basically, in OutbloxMessagePoller, instead of publishing a Spring event, you could publish to RabbitMQ. A worker process in your application could then receive this message and push it into WelcomeEmailTrigger to handle the business logic - I think you could then get rid of the event publisher at all.