nitram509/lib-bpmn-engine

timer event don't trigger properly

lastchiliarch opened this issue · 2 comments

At now the timer is only checked while the engine is running.

If I want to check whether the timer was trigger, I need to write a cron job or a timer to run the engine.

It's awkward , I want a timer event but I still have to use another timer to check timer event.

Maybe the engine could do this work by using a gorontine ito check timers every seconds or some other periods?

Hi @lastchiliarch
that's a very tricky question/wish.

My view on this:

  • lib-bpmn-engine is not aware of how it's deployed = this could be as a single instance OR multi-instance
  • lib-bpmn-engine should not block, when timers are set == is like an implicit pause
  • depending on the deployment, you might better use an embedded timer OR use a central, to avoid duplicate executions
  • hence, setting timers per default, is not fitting for everyone

That said, thank you for your feedback.
I did create #37 to at least document, what's the current approach and options.

Also, I made a note, to think about providing a simple Timer implementation, which must be activated ... something like this...

engine.EnableTimerEventChecker()

What do you think about such approach?

Agreed, I reconsiderd the timer event and it's better to let user to use they own timer.

Embedded timer can't be used in production envrioment or long timer scene (2 days etc) which machine will be restartd or destoryed.

A inner timer seems be useful for short peiord scene or demo needs, I wonder if it's a prior task for us.
Of course, documents are needed to show the useage for timer and explain architectural design.