I am starting to experiment with using events in my ES processes and I'm running into some behavior that I wasn't expecting. If anybody has had any luck with events or has found any good documentation could you please let me know?
Below are the two scenarios that I've been working on. Please feel free to comment, any thoughts would be appreciated.
Scenario 1: I'm catching the "TaskCreated" event on a User action and routing to a script action that basically logs out that the event was caught. When I check the AdminUI for the process I see that the process is being marked as completed. It seems that the user action is "Interupted" the script executes and the process terminates. I was expecting the event to be handled in its own branch, so that I can do some background processing (such as send an email, or update a flag in a database) and still have the main branch continue processing, i.e. the taks still be assigned to the user and not be interupted.
Scenario 2: This scenario is a little more complicated. The flow of the use case is as follows: User A is assigned a task (task A). This task deadlines and the process follows a deadline route which sends an email and assigns a new task (task B) to User B. User B's job is to log into workspace and forward task B to a new user (User C) using the out of the box forward capabilities of workspace. The tricky part is that we actually want User C to be assigned task A not task B. To accomplish this I'm catching the "TaskForwarded" event on the task B user action. This effectively interupts task B and I basically follow a route back to task A and assign it to the user C (which I grab from the caught event on task B). This all works fine if User B only had one instance of Task B. The problem comes when he has multiple instances of Task B, i.e. multiple Task A's have deadlined and he needs to forward them to people. The behavior that I'm seeing is that if I log into workspace as User B and forward one Task B to User C the system fires the TaskForwarded event for all instances of Task B and User C ends up getting assigned a Task A for each instance of Task B. Confusing enough right?! So, I tried to add a filter on my event thinking that if I filter on the process ID I should be able to skip handling the event for the other instances. When I applied this filter it ends up filtering all instances and User C does not get any of the forwarded tasks assigned.
Long story short, I think I need some more detailed documentation on how events work, and what kind of behavior is expected when catching these type of events.
The process will be terminated because when you catch the TaskCreated event, it will execute all the operation in sequence within the same branch. It doesn't create a separate branch when you draw a route from the TaskCreated event to your script operation.
My suggestion is to create a separate process an use the "Start Point" option when you add the TaskCreated event. This way you'll ensure that you have a separate branch when you catch the event and won't interrupt the main process.
I'm still looking at scenario 2. I'll come back to it later when I have a few minutes.
I think you were on the right track with adding a filter. I implemented your logic and I'm getting the same results as you, where all the tasks are being forwarded.
The reason is that for every instance of that task (Task B ), it creates an event listener that listens for an event of type TaskForward. So all tasks instances are basically listening at that point. When you forward you item a TaskForward event is sent and all tasks are catching it. That's why you need to add a filer on the event catcher to make sure you only forward the right one.
What I did is added a filter where I make sure only the items from a particular step and from a particular process are being forwarded. My filter has the two following elements:
I've been playing with events lately and was trying to
"nut out" the semantics of Events being attached to tasks. For an explanation of why you are experiencing Scenario 1 have a look at slide 19 of the BPMN tutorial (http://www.bpmn.org/Documents/OMG%20BPMN%20Tutorial.pdf).
I'm trying to generate a Deadline when a Task is Claimed form a Group Queue.
I've got a TaskClaimed event listener that catches the claim event from the group queue, but I'm stumped on how to then set the Deadline Time for the task when the user has claimed it.
Girish very kindly send me a process that pokes the Deadline Date directly into the ES MySQL table - which does update the Deadline date as show for the task - however A) The Deadline never fires and B) I know poking data into the ES tabels is bad practice.
I've found a 'TaskDeadlineTimer' event that looks like it should do the job but can't figure out how to set it up to set the Deadline for thee specific Process / Task that has been claimed.
Does any one have an example of configuring the 'TaskDeadlineTimer' ?