I might be a little unclear.
I'm trying to create a custom work item handler that can react on external events. Nodes that are going to use that custom work item handler are going to be chained and need to respond to changes on a daily bases (eg. from a batch job).
I'd like to have a work item handler with method executeWorkItem() that can be triggered multiple times from an external signal, for example.
Is it possible to do in custom work item handler at all?
1 of 1 people found this helpful
in order to trigger it again, you would put an intermediate event before it. So if you signal that event, the service task will be called again.
Hope this helps.
thanks for the tip, but that's exactly I'm trying to avoid, because I'm going to have a lot of my custom "waiting work items" (e.g. wait 1 day, then do something, wait next 5 days, do something else, wait next 10 days etc), and for each of them I'll have a separate intermediate event to trigger it.
Ideally, I'd like my custom work item handler to be able to respond to a signal event, giving me ultimate control over my custom work items and minimizing number of nodes. Does anybody know is there a way to "connect" custom work item with a intermediate signal, so that when I call signalEvent(), my custom work item handler's executeWorkItem() method is called?
I'm still a newbie in BPMN, so please pardon if the question is stupid.
In general you cannot just signal any node directly. In some more advanced cases, like ad-hoc subprocess you can, however normally you have to model this as a signal event.
I had a similar scenario. I took the following approach.
- I created my own DB table for my CustomWorkItemHandler. i maintained the Session ID, Process Instance ID, WorkItem ID, and state (as needed by you). Everytime the workitemhandler is executed, it will update the DB table . Note that it DOES not complete or abort the work item.
- In my case i had an external event to complete the work item. Upon receipt of the event, i loaded the persisted ksession, then performed a completeWorkitem for the specific work item ID. I got the work item ID as part of the external event.
This is basically how the Human task works. I had picked the idea from there. HumanTask however is much more complex; while this is a much more simple case.