The hippoevent: component allows you to subscribe events from Event Bus.
The hippoevent: component subscribes the following types of HippoEvent
and transforms it to a JSONObject (net.sf.json.JSONObject)
as message exchange body:
org.onehippo.cms7.event.HippoEvent
org.onehippo.cms7.event.HippoSecurityEvent
org.onehippo.repository.events.HippoWorkflowEvent
org.hippoecm.repository.standardworkflow.FolderWorkflowEvent
For details on how it translates HippoEvent
to a JSONObject
,
please see the JSON message example shown below and the converter source code:
HippoEventConverter.java.
Maven users will need to add the following repository configuration and dependency to their pom.xml to use this component:
<repository> <id>hippo-maven2-forge</id> <name>Hippo Maven 2 Forge</name> <url>https://maven.onehippo.com/maven2-forge/</url> </repository>
<dependency> <groupId>com.bloomreach.forge.camel-hippoevt</groupId> <artifactId>camel-hippoevt</artifactId> <version>${camel-hippoevt.version}</version> </dependency>
NOTE: the Maven coordinate of the module has been changed to
com.bloomreach.forge.camel-hippoevt:camel-hippoevt
since version 3.0.
For the previous versions, please use the groupId
org.onehippo.forge.camel-hippoevt
instead.
hippoevent:
The consumer will register an event listener in Hippo Event Bus.
You can specify parameters like the following:
Name | Default Value | Description |
---|---|---|
_persisted | false | Flag whether or not to register listeners for persisted events from Hippo Repository via Hippo Event Bus. |
_channelName |
Applied to a persisted event listener only.
The listener's channel name is used to identify the listener after a restart, and it should be unique in the container. |
|
_onlyNewEvents | true |
Applied to a persisted event listener only.
Flag whether or not to receive only new events from Hippo Repository via Hippo Event Bus. |
category |
Comma separated category names. Only an event having any of the specified category value will be received.
See org.onehippo.cms7.event.HippoEventConstants for available cateogries.
Note: If the consumer is for persisted events with '_persisted=true', then the first argument of this category parameter will be used in PersistedHippoEventListener#getEventCategory() .
|
|
action |
Comma separated action names. Only an event having any of the specified action value will be received.
See org.onehippo.cms7.event.HippoEvent for detail.
|
|
application |
Comma separated application names. Only an event having any of the specified application value will be received.
See org.onehippo.cms7.event.HippoEvent for detail.
|
|
user |
Comma separated user names. Only an event having any of the specified user value will be received.
See org.onehippo.cms7.event.HippoEvent for detail.
|
|
methodName |
Comma separated method names. Only an event having any of the specified method name value will be received.
See org.onehippo.cms7.event.HippoEvent for detail.
|
So, for example, if you set the parameters like the following example,
then the hippoevent: component will consume a HippoEvent
object
only when the 'category' property value of the HippoEvent
object is 'workflow'
and the 'application' propery value is either 'cms' or 'site'.
hippoevent:?category=workflow&application=cms,site
You will see all the available property names (which can be used as parameter names as well) below.
The message body received by the consumer is a net.sf.json.JSONObject
instance
which should look like the following examples:
Note: The comment blocks (which are actually disallowed in JSON format) are only for description purpose. At runtime, the comments are not included.
{ // metadata property names start with '_'. // A HippoEvent class name: "org.onehippo.cms7.event.HippoEvent", // "org.onehippo.repository.events.HippoWorkflowEvent", // "org.hippoecm.repository.standardworkflow.FolderWorkflowEvent", or // "org.onehippo.cms7.event.HippoSecurityEvent". "_eventClassName" : "org.onehippo.cms7.event.HippoEvent"; // Properties of org.onehippo.cms7.event.HippoEvent: "action" : "...", // See HippoEvent#action() "application" : "...", // HippoEvent#application() "category" : "...", // See HippoEvent#category() "sealed" : false, // See HippoEvent#isSealed() "message" : "...", // See HippoEvent#message() "result" : "...", // See HippoEvent#result() "system" : false, // See HippoEvent#system() "timestamp" : 1234567890, // See HippoEvent#timestamp() "user" : "...", // See HippoEvent#user() // Properties in case of org.onehippo.repository.events.HippoWorkflowEvent "arguments" : [ "value1", ..., "valueN" ], // See HippoWorkflowEvent#arguments() "className" : "...", // See HippoWorkflowEvent#className() "exception" : "...", // HippoWorkflowEvent#exception()#toString() "interaction" : "...", // See HippoWorkflowEvent#interaction() "interactionId" : "...", // See HippoWorkflowEvent#interactionId() "methodName" : "...", // See HippoWorkflowEvent#methodName() "returnType" : "...", // See HippoWorkflowEvent#returnType() "returnValue" : "...", // See HippoWorkflowEvent#returnValue() "subjectId" : "...", // See HippoWorkflowEvent#subjectId() "subjectPath" : "...", // See HippoWorkflowEvent#subjectPath() "workflowCategory" : "...", // See HippoWorkflowEvent#workflowCategory() "workflowName" : "...", // See HippoWorkflowEvent#workflowName() "documentType" : "ns1:news", // See HippoWorkflowEvent#documentType() "documentPath" : "...", // See HippoWorkflowEvent#documentPath() "handleUuid" : "...", // See HippoWorkflowEvent#handleUuid() // Properties in case of org.hippoecm.repository.standardworkflow.FolderWorkflowEvent: "type" : "...", // FolderWorkflowEvent#type()#toString() // Properties in case of org.onehippo.cms7.event.HippoSecurityEvent: "success" : true, // See HippoSecurityEvent#exception() }
The following code will register a local EventListener in Hippo Event Bus.
And it will consume HippoEvent
only when the 'category' property value is 'workflow'
and the 'action' property value is either 'publish' or 'depublish'.
<route> <from uri="hippoevent:?category=workflow&action=publish,depublish" /> <to uri="direct:execute-reaction" /> </route>
The following code will register a persisted EventListener in Hippo Event Bus.
And it will consume HippoEvent
only when the 'category' property value is 'workflow'
and the 'action' property value is either 'publish' or 'depublish'.
<route> <from uri="hippoevent:?_persisted=true&_channelName=mylistener&category=workflow&action=publish,depublish" /> <to uri="direct:execute-reaction" /> </route>