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.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
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.