nservicebus saga long running process -
i have long running process 4 steps. s1, s2, s3, s4. s2 , s3 running sequential, s1 can run parallel s2. s4 can run parallel s1, s2 , s3.
not processes need run through steps. need s2 , s3. others maybe use s2 , s4.
now create 1 saga class , handle s1,s2,s3 , s4. many if statements in message , timeout handlers. next month needs implement s5, running parallel s3 , s4.
it possible create 1 saga per possible process flow, that's many duplicated code. possible create class each step , compose each different process flow implementing needed steps in different saga classes?
should build 4 saga's , control process flow extern controller , using saga perform needed timeouts , persistance?
this sounds classic scatter/gather pattern, can implement in 1 saga.
at beginning, you'll have logic determines steps (all of can run in parallel) need doing. should send commands have things done, , record in saga data steps awaiting responses from.
each step happens message handler external saga , bus.reply()
when complete.
as reply messages come in, saga notes each step completed, , when steps completed, can take additional action continue, publishing sort of completion event.
Comments
Post a Comment