Package org.openspaces.events
Interface EventExceptionHandler<T>
- All Known Implementing Classes:
DefaultArchivePollingContainerExceptionHandler
public interface EventExceptionHandler<T>
An exception handler to handle exception when invoking event listeners. The exception can be
propagated or handled internally.
If the event container is transactional, then propagating the exception will cause the transaction to rollback, which handling it will cause the transaction to commit.
- Author:
- kimchy (shay.banon)
-
Method Summary
Modifier and TypeMethodDescriptionvoidonException(ListenerExecutionFailedException exception, T data, GigaSpace gigaSpace, org.springframework.transaction.TransactionStatus txStatus, Object source) A callback to handle exception in an event container.voidonSuccess(T data, GigaSpace gigaSpace, org.springframework.transaction.TransactionStatus txStatus, Object source) A callback when a successful execution of a listener.
-
Method Details
-
onSuccess
void onSuccess(T data, GigaSpace gigaSpace, org.springframework.transaction.TransactionStatus txStatus, Object source) throws RuntimeException A callback when a successful execution of a listener.- Parameters:
data- The actual data object of the eventgigaSpace- A GigaSpace instance that can be used to perform additional operations against the spacetxStatus- An optional transaction status allowing to rollback a transaction programmaticallysource- Optional additional data or the actual source event data object (where relevant)- Throws:
RuntimeException
-
onException
void onException(ListenerExecutionFailedException exception, T data, GigaSpace gigaSpace, org.springframework.transaction.TransactionStatus txStatus, Object source) throws RuntimeException A callback to handle exception in an event container. The handler can either handle the exception or propagate it.If the event container is transactional, then propagating the exception will cause the transaction to rollback, while handling it will cause the transaction to commit.
The
TransactionStatuscan also be used to control if the transaction should be rolled back without throwing an exception.- Parameters:
exception- The listener thrown exceptiondata- The actual data object of the eventgigaSpace- A GigaSpace instance that can be used to perform additional operations against the spacetxStatus- An optional transaction status allowing to rollback a transaction programmaticallysource- Optional additional data or the actual source event data object (where relevant)- Throws:
RuntimeException
-