When does saga serialize

When does the saga serialization and de-serialization happens?
I assume as soon as saga methods are done it will get serialised and then when there's a message again for the same saga then it will get de-serialised.
But if there a deadline that is scheduled on the saga then would it wait for the timer.
I assume that it will get serialised and the timer execution happens in a decoupled fashion and doesn't affect saga's serialisation or de-serialisation.
Could someone confirm please.

Regards
Vikram

Hi,

That’s indeed how it happens! The Event Scheduler just schedules an event which is handled by the Saga like any other event triggered by the system.

Cheers,

Allard

Thanks Allard.
The event scheduling part is clear. But the timer part is where I think I need a little more clarity.

If on the saga an event is scheduled for after 5 seconds then does the saga serialisation happens after 5 seconds, i.e. waiting for the timer to complete. I guess no but not sure. Similarly if the 5 seconds timer is an in memory rather than quartz does that change the serialisation timing.

Also when the quartz timer runs for 5 seconds would that first cause saga to be loaded/ deserialised into memory.

Regards
Vikram

Hi Vikram,

Event Scheduling and the timer are the same thing. Components scheduling an event will not wait for the timer to complete. They just ‘move on’. Once the timer triggers, an event is published and the Saga is triggered again to process this event, in a different transaction. Each time a Saga is triggered, it is deserialized (unless available in a cache), invoked, and then serialized again to be stored.

Hope this helps.
Allard

Definitely helps.

Thanks Allard.

  • Vikram