Hi all,
My application's use case requires that client who starts workflow gets async notification on workflow progress.
For that purpose I have ActivitiEventListener instance and my plan was to dispatch ACTIVITY_STARTED and ACTIVITY_COMPLETED events back to the client, but if I have multiple executions going on the same engine I can't distinguish events because caller finds out it's process instance id only upon return of startWorkflow method.
Next idea was to employ an engine pool and execute one workflow at the time per engine, but than I have learned that in case of async activities some other engine can pick up a job and events from that job will never get to the caller.
So, I moved back to one engine - multiple executions, but with unique business key that will help me figure out how to dispatch events. But to my disappointment business key doesn't appear in event and it seems to me that I can only get it from execution context.
Finally, I have added a method to ActivitiEvent interface:
ExecutionContext getExecutionContext();
and implemented it in ActivitiEventImpl as:
public ExecutionContext getExecutionContext() {
return Context.getExecutionContext();
}
Now, I can get my business key from event but what bothers me is the question if there is a better way to do this?
Or, is there any reason (that I don't see yet) why not to do it this way?
Thanks.
Boris