Skip to content

dzer6/camel-arangodb

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

Build

mvn clean install

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 !

About

Camel ArangoDB Component

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Java 100.0%