DEV Community

Discussion on: Transactional Outbox Pattern in a monolithic application

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.