As we transition to the new Hyland Community, some post links may be temporarily disrupted as we finalize redirects. We apologize for the inconvenience and are working to resolve this as quickly as possible. Details.
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.
@Overridepublic void onEvent(ActivitiEvent event) { if( (event instanceof ActivitiActivityEvent) &&("receiveTask".equals( ((ActivitiActivityEvent) event).getActivityType()) ) &&( ActivitiEventType.ACTIVITY_COMPLETED.equals( event.getType() ) ) ){・・・・・・・・・・・・・・・・・ }}
@Overridepublic 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);