This is an automated email from the ASF dual-hosted git repository. acosentino pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel.git
commit 919c3c8fe887779144f24a6261ae631d55fcd5be Author: Andrea Cosentino <anco...@gmail.com> AuthorDate: Fri Sep 3 08:10:48 2021 +0200 CAMEL-16849 - Add at least one example for component in docs - Camel-ArangoDB --- .../src/main/docs/arangodb-component.adoc | 41 ++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/components/camel-arangodb/src/main/docs/arangodb-component.adoc b/components/camel-arangodb/src/main/docs/arangodb-component.adoc index 83f2c6d..35ac63b 100644 --- a/components/camel-arangodb/src/main/docs/arangodb-component.adoc +++ b/components/camel-arangodb/src/main/docs/arangodb-component.adoc @@ -136,4 +136,45 @@ with the following path and query parameters: |=== // endpoint options: END +== Examples + +=== Producer Examples + +==== Save document on a collection + +[source,java] +-------------------------------------------------------------------------------- +from("direct:insert") + .to("arangodb:testDb?documentCollection=collection&operation=SAVE_DOCUMENT"); +-------------------------------------------------------------------------------- + +And you can set as body a BaseDocument class + +-------------------------------------------------------------------------------- + BaseDocument myObject = new BaseDocument(); + myObject.addAttribute("a", "Foo"); + myObject.addAttribute("b", 42); +-------------------------------------------------------------------------------- + +==== Query a collection + +[source,java] +-------------------------------------------------------------------------------- +from("direct:query") + .to("arangodb:testDb?operation=AQL_QUERY +-------------------------------------------------------------------------------- + +And you can invoke an AQL Query in this way + +-------------------------------------------------------------------------------- + String query = "FOR t IN " + COLLECTION_NAME + " FILTER t.value == @value"; + Map<String, Object> bindVars = new MapBuilder().put("value", "hello") + .get(); + + Exchange result = template.request("direct:query", exchange -> { + exchange.getMessage().setHeader(AQL_QUERY, query); + exchange.getMessage().setHeader(AQL_QUERY_BIND_PARAMETERS, bindVars); + }); +-------------------------------------------------------------------------------- + include::{page-component-version}@camel-spring-boot::page$arangodb-starter.adoc[]