Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Update documentation on use of message headers

...

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

Code Block

<dependency>
    <groupId>org.apache.camel</groupId>
    <artifactId>camel-jcr</artifactId>
    <version>x.x.x</version>
    <!-- use the same version as your Camel core version -->
</dependency>

URI format

Code Block

jcr://user:password@repository/path/to/node

...

  • If the operation is CamelJcrInsert: A new node is created in the content repository, all the message properties headers of the IN message are transformed to JCR 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.
Note

Please note that the JCR Producer used message properties instead of message headers in Camel versions earlier than 2.12.3. See https://issues.apache.org/jira/browse/CAMEL-7067 for more details.

 

Consumer

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 attribute property is added to the node as well: my.contents.property which will contain the body of the message being sent.

...

Code Block
from("direct:a").setHeader(JcrConstants.JCR_NODE_NAME, constant("node"))
    .setHeader("my.contents.property", body())
    .to("jcr://user:pass@repository/home/test");

 

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.

Code Block
xml
xml

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

Include Page
Endpoint See Also
Endpoint See Also