Is there a way for me to extend ReceiveTaskActivityBehavior and override its behavior? I am not sure how to create a single listener which can be used across all Receive tasks for a workflow - in the same way as a ServiceTask listener can be configured to be used as a listener for many ServiceTasks - so I am trying to see if this can be an option.
Thanks for your answers in advance.
> I am not sure how to create a single listener which can be used across all Receive tasks for a workflow - in the same way as a ServiceTask listener can be configured to be used as a listener for many ServiceTasks - so I am trying to see if this can be an option.
You can use ActivitiEventListener.
https://www.activiti.org/userguide/#eventDispatcherListener
1. Make ActivitiEventListener that will be executed in only recive task.
I attached tha sample java code.
@Override
public void onEvent(ActivitiEvent event) {
if( (event instanceof ActivitiActivityEvent)
&&("receiveTask".equals( ((ActivitiActivityEvent) event).getActivityType()) )
&&( ActivitiEventType.ACTIVITY_COMPLETED.equals( event.getType() ) )
){
・・・・・・・・・・・・・・・・・
}}
2. SetEventListeners to ProcessEngineConfiguration
ProcessEngineConfiguration processEngineConfiguration = ProcessEngineConfiguration.createStandaloneInMemProcessEngineConfiguration();
List<ActivitiEventListener> eventListeners = new ArrayList<ActivitiEventListener>();
eventListeners.add(new YourActivitiEventListener());
((ProcessEngineConfigurationImpl)processEngineConfiguration).setEventListeners(eventListeners);
Ask for and offer help to other Alfresco Process Services and Activiti Users and members of the Alfresco team.
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.