An open API service indexing awesome lists of open source software.

https://github.com/bbonnin/camel-arangodb

Camel ArangoDB Component
https://github.com/bbonnin/camel-arangodb

apache-camel arangodb database nosql

Last synced: about 2 months ago
JSON representation

Camel ArangoDB Component

Awesome Lists containing this project

README

          

# camel-arangodb
Camel ArangoDB Component

For more details about ArangoDB, consult the [ArangoDB web site](https://www.arangodb.com/).

> 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

```bash
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
```xml

io.millesabords.camel
camel-arangodb
1.0

```

### 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)
```java
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)
```java
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)
```java
from("direct:delete_user")
.to("arangodb:config?database=testdb&collection=users&operation=delete")
.to("mock:result");
```

* Log all the users

```java
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 !