cancel
Showing results for 
Search instead for 
Did you mean: 

cdi-enabled task listener (programmatic hook)

mandas
Champ in-the-making
Champ in-the-making
Hi all,

(activiti-5.11)

Is there any way to programmatically hook a CDI-enabled task listener to any task creation? I 've tried with AbstractBpmnParseListener but TaskDefinition.addTaskListener() requires me to instantiate the actual bean.

Thanks,
Dimitris
1 REPLY 1

frederikherema1
Star Contributor
Star Contributor
You can add a "DelegateExpressionTaskListener" instance instead of your CDI-bean instance. When this task-listener is called, the expression-manager will be used to fetch the BEAN instance from CDI.

You can pass in an Expression to the constructor of the DelegateExpressionTaskListener class, using expressionManager.createExpression("${cdiTaskListenerName}");