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 29d71256b0d4fcfe29f00a102ec9713df8d5d9e6 Author: Andrea Cosentino <anco...@gmail.com> AuthorDate: Fri Sep 3 08:15:36 2021 +0200 CAMEL-16849 - Add at least one example for component in docs - Camel-ArangoDB --- .../modules/ROOT/pages/arangodb-component.adoc | 41 ++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/docs/components/modules/ROOT/pages/arangodb-component.adoc b/docs/components/modules/ROOT/pages/arangodb-component.adoc index a3c59e0..dcba19a 100644 --- a/docs/components/modules/ROOT/pages/arangodb-component.adoc +++ b/docs/components/modules/ROOT/pages/arangodb-component.adoc @@ -138,4 +138,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[]