0

In general, when designing a system which has multiple events happening in some well pre-defined logical order, are there any benefits to either requesting all necessary timeouts at the beginning of the process, or requesting always only the "next" timeout (or in other words, the timeout for the next event)?

To clarify, I'm talking about a scenario when you want a number of things to happen sequentially. Event A should happen 3 hours after initialization, Event B 10 hours after initialization, and Event C 48 hours after initialization of some process.

When the process is started, should it request a timeout only for Event A (which would then in turn request a timeout for Event B, and so on), or should it immediately request a timeout for all the Events?

In our case the process might be stopped at any point in time - Thus if it's stopped 5 hours after initialization then Event A should have already happened, and Events B and C should not happen at all.

A process might also in special cases be initiated midway through (ie "Start process 5 hours in", in which case Event B should happen 5 hours later), and the timelines of individual processes might be updated manually (ie "Lets postpone Event B by 2.5 hours for this single process instance).

Any thoughts appreciated,

1 Answers1

0

If I got your scenario ok, you can start this with a saga that is started by an initial message that starts the process, on handling the initial message you would request the timeouts you expect and in the timeout handlers checking whether the other events/operation where handled and acting based on the current state...

Does that make sense?

Sean Farmar
  • 2,254
  • 13
  • 10
  • Yes that does make sense. Do you think it would be better to request all the timeout upon saga initialization like you describe? The alternative being only requesting the first timeout, and in the first timeouts handler request the 2nd timeout (after doing some other work), and so on? I'm not sure if one is preferable over the other. I'm trying to make the right decision to make future maintenance/changes/expansions easier - although I don't even know what those future changes might be. –  Dec 23 '18 at 22:12
  • Thing is, messages might and will come out of order, so I'd go with all in one saga and manage the process there. If you are want email me on sean.farmar at particular.net for a quick chat? – Sean Farmar Dec 24 '18 at 18:56