Interface RetrievalEventActionHandler
-
public interface RetrievalEventActionHandlerAn interface to be implemented as an event action handler, which runs on the server. When an operation is performed on an object with a subscription, and that operation is one of the subscribed events for that subscription, the event handler will be invoked. For any event other thanGetContentEvent, use theEventActionHandlerinterface instead.When implementing an event action handler, consider the following points:
- A
RetrievalEventActionHandlerimplementation works only with an an event of typeGetContentEvent. If a handler written exclusively forGetContentEventinadvertently has other events included in the subscribed event list for a subscription, a runtime exception will be thrown because the first event passed to the handler will be anObjectChangeEvent. - You can configure an event action handler (through the
Subscriptionobject) to run synchronously or asynchronously. - If a synchronous event action handler fails, an exception will return to the client and the transaction will be rolled back.
If an asynchronous event action handler fails, an exception will be logged to the server, and the asynchronous action will remain in the
QueueItemand retried as often as set in the RetryCount property. - An asynchronous event action handler can update a source object, but it must first fetch the persisted instance of the source object before updating it.
Do not update the source object passed to the asynchronous handler.
A synchronous event action handler cannot update a source object. It is not supported.
- You can implement an event action handler as a Java or JavaScript component.
You can check in a Java event action handler as a
CodeModuleobject, or you can specify a Java event action handler in the classpath of the application server where the Content Engine is running.If a Java event handler is intended to work with both
ObjectChangeEventandGetContentEvent, it must implement both interfaces. For example:
public class NewEventHandler implements EventActionHandler, RetrievalEventActionHandler.Because JavaScript is loosely typed, you do not specify the event type in the
Therefore, you need only a singleonEventmethod signature.OnEventmethod for a JavaScript event handler to work with bothObjectChangeEventandGetContentEvent.
- A
-
-
Method Summary
Methods Modifier and Type Method and Description voidonEvent(RetrievalEvent event, Id subscriptionId)Invoked when an operation on an object triggers a subscribed event.
-
-
-
Method Detail
-
onEvent
void onEvent(RetrievalEvent event, Id subscriptionId) throws EngineRuntimeException
Invoked when an operation on an object triggers a subscribed event. Implement this method with the actions to be taken whenGetContentEventis triggered.- Parameters:
event- An event of typeRetrievalEvent. Of theRetrievalEventsubclasses, onlyGetContentEventis subscribable. so only aGetContentEventobject can be passed to this method.subscriptionId- An Id value that represents the GUID of the subscription that defines the triggered event. You can use this value to retrieve theSubscriptionobject with which this handler is associated.- Throws:
EngineRuntimeException
-
-