Available as of Camel Extra 2.11
The camel-spring-neo4j library is provided by the Camel Extra project which hosts *GPL related components for Camel.
The neo4j: component allows you to treat Neo4j as a camel producer endpoint. This means you can use this component in to() calls but not from() calls. This component is backed by the Spring Data Neo4j Library.
Maven users will need to add the following dependency to their pom.xml
for this component:
<dependency> <groupId>org.apache.camel</groupId> <artifactId>camel-spring-neo4j</artifactId> <version>x.x.x</version> <!-- use the same version as your Camel core version --> </dependency> |
spring-neo4j:http://hostname[:port]/database?options |
Where the URL is the location of the of running neo4j rest server.
The following headers are set on exchanges during message transport.
|
The producer will set the headers for downstream processors once the operation has taken place. Any ID headers set prior to the producer are ignored.
The neo4j component looks for the Neo4jOperation header to determine what kind of entity to create, which is one of the following enum types
`CREATE_NODE, REMOVE_NODE, CREATE_RELATIONSHIP, REMOVE_RELATIONSHIP`
The body of the message is used to determine the node or relationship to manipulate. The following body types are supported:
For CREATE_NODE:
For REMOVE_NODE:
For CREATE_RELATIONSHIP:
For REMOVE_RELATIONSHIP:
If you wanted to insert a new empty node every 1 seconds
from("timer://foo?period=1000").to("spring-neo4j:http://localhost:7474/data") |
If you wanted to delete a specific node specified by a filename, eg a file of 100 would delete node 100.
from("file:/var/data").process(new Processor() { @Override public void process(Exchange exchange) throws Exception { exchange.getIn().setBody(exchange.getIn().getHeader("CamelFileName")); } }).to("spring-neo4j:http://localhost:7474/data") |