Skip to content
master
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
src
 
 
 
 
 
 
 
 
 
 

camel-arangodb

Camel ArangoDB Component

For more details about ArangoDB, consult the ArangoDB web site.

ArangoDB is a multi-model database. But, at this moment, this component is only dedicated to the document model. ArangoDB is available as a Docker container: see https://www.arangodb.com/download-major/docker/

Latest news

  • Version 2.0: support for ArangoDB 3.1 or above (tested with 3.3.19)

Build

mvn clean install

For the tests, start an ArangoDB server, e.g. docker run -p 8529:8529 -e ARANGO_ROOT_PASSWORD=openSesame arangodb/arangodb:3.3.19

How to use

Dependency

Add the dependency in your pom.xml

<dependency>
  <groupId>io.millesabords.camel</groupId>
  <artifactId>camel-arangodb</artifactId>
  <version>1.0</version>
</dependency>

URI format

arangodb:configBean?database=databaseName&collection=collectionName&operation=operationName[&moreOptions...]

Endpoint options

nameDefault valueDescription
databasenoneRequired. Name of the default database.
collectionnoneName of the collection to which this endpoint will be bound.
hostlocalhostHostname where ArangoDB is running.
port8529Port of ArangoDB.
operationnoneOperation to execute (insert, update, delete, get, aql_query).
aqlnoneAQL query to execute (if operation is aql_query).

Headers

nameDescription
_arango.operationOperation to execute (insert, update, delete, get, aql_query).
_arango.collectionName of the collection to use by the producer.
_arango.aql_queryAQL query to execute (if operation is aql_query).
_arango.aql_query_varsVariables to use with the AQL query.

Sample routes

  • Insert a user in a collection 'users' (the body must be a BaseDocument instance)
from("direct:insert_user")
    .to("arangodb:config?database=testdb&collection=users&operation=insert")
    .to("mock:result");
  • Find a user (the body must be the document key of the user and you will find the document in the body)
from("direct:get_user")
    .to("arangodb:config?database=testdb&collection=users&operation=get")
    .to("mock:result");
  • Delete a user (the body must be the document key)
from("direct:delete_user")
    .to("arangodb:config?database=testdb&collection=users&operation=delete")
    .to("mock:result");
  • Log all the users
from("direct:log_users_bob")
    .setHeader(ArangoDbConstants.ARANGO_AQL_QUERY_HEADER)
        .constant("FOR u IN users FILTER u.name == @name RETURN u")
    .setHeader(ArangoDbConstants.ARANGO_AQL_QUERY_VARS_HEADER)
        .constant(new MapBuilder().put("name", "bob").get())
    .to("arangodb:config?database=testdb&operation=aql_query")
        .split(body())
            .log("${body}")
    .to("mock:result");

The next steps

Feel free to send PRs to fix issues, add new features, etc. Any comments/questions/comments are welcome !