Child pages
  • JCR
Skip to end of metadata
Go to start of metadata

JCR Component

The jcr component allows you to add/read nodes to/from a JCR compliant content repository (for example, Apache Jackrabbit) with its producer, or register an EventListener with the consumer.

Maven users will need to add the following dependency to their pom.xml for this component:

    <!-- use the same version as your Camel core version -->

URI format


Consumer added

From Camel 2.10 onwards you can use consumer as an EventListener in JCR or a producer to read a node by identifier.


The repository element of the URI is used to look up the JCR Repository object in the Camel context registry.


When a message is sent to a JCR producer endpoint:

  • If the operation is CamelJcrInsert: A new node is created in the content repository, all the message headers of the IN message are transformed to javax.jcr.Value instances and added to the new node and the node's UUID is returned in the OUT message.
  • If the operation is CamelJcrGetById: A new node is retrieved from the repository using the message body as node identifier.

Please note that the JCR Producer used message properties instead of message headers in Camel versions earlier than 2.12.3. See for more details.



The consumer will connect to JCR periodically and return a List<javax.jcr.observation.Event> in the message body.


The snippet below creates a node named node under the /home/test node in the content repository. One additional property is added to the node as well: which will contain the body of the message being sent.

from("direct:a").setHeader(JcrConstants.JCR_NODE_NAME, constant("node"))
    .setHeader("", body())


The following code will register an EventListener under the path import-application/inbox for Event.NODE_ADDED and Event.NODE_REMOVED events (event types 1 and 2, both masked as 3) and listening deep for all the children.

    <from uri="jcr://user:pass@repository/import-application/inbox?eventTypes=3&deep=true" />
    <to uri="direct:execute-import-application" />

  • No labels