Can K2 workflow keep monitoring on data in DB to control flow?

  • 19 December 2008
  • 5 replies
  • 1 view

Badge +2

My understanding is that K2 needs external trigger (UI or Process) that retrieves work list and kicks off action to make the flow happens, is it possible for K2 workflow to monitor some data in DB and trigger flow based on the value from the data?


For example, if the system must send mass email automatically if some values from DB = something, can we define flows in K2 to do that? 


 


5 replies

Badge +4

It is possible to design a data-polling process, however you must be very careful to design the process correctly so as not to create an infinitive process. You can then use a Server Event to build some code to connect to the DB and check the data, but bottom line is that there is no standard K2 feature to do this including keeping before and after images of the data for comparison.


 


In a similar manner you can develop an Event Recorder for K2 blackpearl that is registered with the Event Bus in K2. This recorder then polls the DB and can then fire some or other action, e.g. trigger a process, when a certain condition is met based on how you have coded the recorder. There is an example of a File Listener in the K2 documentation which listens for new/changed files in a specified folder.


 


The other option is to develop a trigger on the DB table and this trigger could then integrate with K2, therefore making use of the built-in DB features to check if data has changed, what columns, etc.


 

Badge +2

Thanks Samuel.


So there is some scheduling service in K2 that can do the polling based on some interval setting?


 

Badge +9
Yes, there is the "Event Bus Scheduler".  Currently the only access to this is via API.  There is are code examples of how to interact with this located in the K2 Users Guide > Developer Reference > Extending the K2 Platform > How to register new events with the Event Bus.
Badge +2
The "Event Bus Scheduler" API sounds too complicated, isn't there supposed to be something handy in a workflow engine that can be used to trigger something like a timer/scheduler?
Badge +13
You can use escalation via time interval to perform your check.   Doing it every 5 minutes over 2 weeks might fill up your log since each escalation is logged.

Reply