cancel
Showing results for 
Search instead for 
Did you mean: 

Asynchronous notification on workflow progress

bpran
Champ in-the-making
Champ in-the-making
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
2 REPLIES 2

jbarrez
Star Contributor
Star Contributor
Another way to do it, is to use a BpmnParseHandler that adds execution listeners to every of your process definitions automatically. Those listeners can then fire the stuff async.

bpran
Champ in-the-making
Champ in-the-making
It seems it is the right way to do it. I should have read manual more carefully. Smiley Happy
Thanks.
Getting started

Tags


Find what you came for

We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.