Interface RetrievalEventActionHandler
-
public interface RetrievalEventActionHandler
An 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 theEventActionHandler
interface instead.When implementing an event action handler, consider the following points:
- A
RetrievalEventActionHandler
implementation works only with an an event of typeGetContentEvent
. If a handler written exclusively forGetContentEvent
inadvertently 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
Subscription
object) 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
QueueItem
and 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
CodeModule
object, 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
ObjectChangeEvent
andGetContentEvent
, 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 singleonEvent
method signature.OnEvent
method for a JavaScript event handler to work with bothObjectChangeEvent
andGetContentEvent
.
- A
-
-
Method Summary
Methods Modifier and Type Method and Description void
onEvent(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 whenGetContentEvent
is triggered.- Parameters:
event
- An event of typeRetrievalEvent
. Of theRetrievalEvent
subclasses, onlyGetContentEvent
is subscribable. so only aGetContentEvent
object 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 theSubscription
object with which this handler is associated.- Throws:
EngineRuntimeException
-
-