You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using the persistent events part of modulith which is simplifying a lot our code. But I'm facing a few use cases where I wish I could delay the event execution, for example, "send a reminder in 24 hours". While this can be done with a schedule and a DB table keep track of things. I feel like implementing it inside modulith will yield a far simpler implementation and a better usability.
It could be something like this:
interface DelayedEvent {
Instant fireAt(); // null means immediately
}
When receiving such an event, the modulith listener would just persist it in the persistent_events table with fireAt. At a later point some schedule will trigger the execution in the same way failed event listeners are run when restarting the application.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I'm using the persistent events part of modulith which is simplifying a lot our code. But I'm facing a few use cases where I wish I could delay the event execution, for example, "send a reminder in 24 hours". While this can be done with a schedule and a DB table keep track of things. I feel like implementing it inside modulith will yield a far simpler implementation and a better usability.
It could be something like this:
When receiving such an event, the modulith listener would just persist it in the
persistent_events
table withfireAt
. At a later point some schedule will trigger the execution in the same way failed event listeners are run when restarting the application.Beta Was this translation helpful? Give feedback.
All reactions