EventCallbackService

public interface EventCallbackService

Implementing EventCallbackService and exposing it as OSGi service allows to receive callbacks, after the events have been handled by their respective listener. In order to invoke a callback, the name of the callback service must be set in the MotechEvent and must match the name returned by the getName() method.

Methods

failureCallback

boolean failureCallback(MotechEvent event, Throwable throwable)

Callback method, invoked when the event handler method has thrown an exception.

Parameters:
  • event – the event that was being handled
  • throwable – the throwable that has caused the failure
Returns:

true, if the event system should proceed with retries; false otherwise

getName

String getName()

The name of this callback. It must match the name set in the MotechEvent.callbackName in order to have the callbacks invoked.

Returns:callback name

successCallback

void successCallback(MotechEvent event)

Callback method, invoked when the event handler method has executed successfully.

Parameters:
  • event – the event that has been handled