06-21-2017 08:41 PM
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.
06-22-2017 05:29 AM
> 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);
Explore our Alfresco products with the links below. Use labels to filter content by product module.