{"id":16284961,"url":"https://github.com/goodforgod/micronaut-arangodb","last_synced_at":"2025-03-20T02:31:22.858Z","repository":{"id":41848669,"uuid":"243830815","full_name":"GoodforGod/micronaut-arangodb","owner":"GoodforGod","description":"⚙️ Integration between Micronaut and ArangoDB.","archived":false,"fork":false,"pushed_at":"2023-08-13T22:06:14.000Z","size":476,"stargazers_count":11,"open_issues_count":1,"forks_count":7,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-03-17T13:46:41.709Z","etag":null,"topics":["arangodb","configuration","integration","micronaut","micronaut-arangodb","micronaut-configuration"],"latest_commit_sha":null,"homepage":"https://micronaut.io","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/GoodforGod.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-02-28T18:39:58.000Z","updated_at":"2024-02-08T17:49:43.000Z","dependencies_parsed_at":"2024-10-10T19:21:59.308Z","dependency_job_id":"a9500154-a7c6-42b6-ad2c-771024582cf7","html_url":"https://github.com/GoodforGod/micronaut-arangodb","commit_stats":null,"previous_names":[],"tags_count":20,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GoodforGod%2Fmicronaut-arangodb","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GoodforGod%2Fmicronaut-arangodb/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GoodforGod%2Fmicronaut-arangodb/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GoodforGod%2Fmicronaut-arangodb/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/GoodforGod","download_url":"https://codeload.github.com/GoodforGod/micronaut-arangodb/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244538588,"owners_count":20468745,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["arangodb","configuration","integration","micronaut","micronaut-arangodb","micronaut-configuration"],"created_at":"2024-10-10T19:21:43.371Z","updated_at":"2025-03-20T02:31:22.425Z","avatar_url":"https://github.com/GoodforGod.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Micronaut ArangoDB Configuration\n\n![GraalVM Enabled](https://img.shields.io/badge/GraalVM-Ready-orange?style=plastic)\n[![Minimum required Java version](https://img.shields.io/badge/Java-17%2B-blue?logo=openjdk)](https://openjdk.org/projects/jdk/17/)\n[![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.github.goodforgod/micronaut-arangodb/badge.svg)](https://maven-badges.herokuapp.com/maven-central/com.github.goodforgod/micronaut-arangodb)\n![Java CI](https://github.com/GoodforGod/micronaut-arangodb/workflows/CI%20Master/badge.svg)\n[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=GoodforGod_micronaut-arangodb\u0026metric=alert_status)](https://sonarcloud.io/dashboard?id=GoodforGod_micronaut-arangodb)\n[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=GoodforGod_micronaut-arangodb\u0026metric=coverage)](https://sonarcloud.io/dashboard?id=GoodforGod_micronaut-arangodb)\n[![Maintainability Rating](https://sonarcloud.io/api/project_badges/measure?project=GoodforGod_micronaut-arangodb\u0026metric=sqale_rating)](https://sonarcloud.io/dashboard?id=GoodforGod_micronaut-arangodb)\n\nThis project includes integration between Micronaut and ArangoDB.\n\n## Dependency :rocket:\n\n[**Gradle**](https://mvnrepository.com/artifact/com.github.goodforgod/micronaut-arangodb)\n```groovy\nimplementation \"com.github.goodforgod:micronaut-arangodb:5.0.0\"\n```\n\n[**Maven**](https://mvnrepository.com/artifact/com.github.goodforgod/micronaut-arangodb)\n```xml\n\u003cdependency\u003e\n    \u003cgroupId\u003ecom.github.goodforgod\u003c/groupId\u003e\n    \u003cartifactId\u003emicronaut-arangodb\u003c/artifactId\u003e\n    \u003cversion\u003e5.0.0\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\n## Configuration\n\nIncludes a configuration to automatically configure the native [ArangoDB Java drive](https://github.com/arangodb/arangodb-java-driver). \nJust configure the host, port, credentials (if needed) of the ArangoDB accessor in *application.yml*.\n\n```yaml\narangodb:\n  host: localhost     # default\n  port: 8529          # default\n  database: _system   # default (is used for health check)\n  user: root          # default\n  password: 1234      # or no pass if auth is not required\n```\n\n### Accessors\n\n*ArangoDB* accessor is available for dependency injection.\n\nAccessors injected as [**singleton**](https://docs.micronaut.io/latest/guide/index.html#builtInScopes) \nbeans remember that while using them.\n\n```java\n@Inject\nprivate ArangoDB accessor;\n```\n\nIn case you want inject clients as [**prototypes**](https://docs.micronaut.io/latest/guide/index.html#builtInScopes)\nyou can use *named* bean injection.\n\n```java\n@Named(\"prototype\")\n@Inject\nprivate ArangoDB accessor;    \n```\n\n### ArangoSerde\n\nYou can provide custom *ArangoSerde* serialization module as bean, and it will be used while building ArangoDB accessor or client.\n\nArangoSerialization factory example:\n```java\n@Factory\npublic class ArangoSerdeFactory {\n\n    @Bean\n    public ArangoSerde getArangoSerde() {\n        return new JacksonSerdeImpl(new ObjectMapper());\n    }\n}\n```\n\n### Clients\n\nConfiguration supports setup database for your application \n(ArangoDB accessors do not require or have database config).\n\nIn order to use database specified as per [configuration](#Configuration) inject provided Arango Clients instead.\n\nClients injected as [**singletons**](https://docs.micronaut.io/latest/guide/index.html#builtInScopes) \nbeans remember that while using them.\n\n```java\n@Inject\nprivate ArangoClient client;\n```\n\nBoth clients provide as sync and async implementation and are same [accessors](#Accessors) \nbut with knowledge about database specified per config.\nSo you can use connection with knowledge about database your app is working with.\n\n```java\n@MicronautTest\nclass ArangoClientTests {\n\n    @Inject\n    private ArangoClient client;    \n\n    void checkConfiguredDatabase() {\n        final String databaseSync = client.getDatabase(); // Database as per config\n        assertEquals(database, database);\n    }\n}\n```\n\nIn case you want inject clients as [**prototypes**](https://docs.micronaut.io/latest/guide/index.html#builtInScopes) \nyou can use *named* bean injection.\n\n```java\n@Named(\"prototype\")\n@Inject\nprivate ArangoClient client;    \n```\n\n### Configuring ArangoDB Driver\n\nAll accessors and clients are provided as [**refreshable**](https://docs.micronaut.io/latest/guide/index.html#builtInScopes) with *arangodb* key for bean refresh.\n\nConfiguration supports all available ArangoDB driver settings.\n\nConfiguring timeout, chunksize, maxConnections, connectionTtl, acquireHostList, loadBalancingStrategy for *clients \u0026 accessors*\n\nCheck [ArangoDB official](https://www.arangodb.com/docs/stable/drivers/java-reference-setup.html) info about each parameter.\n\n```yaml\narangodb:\n  hosts: localhost:8080,localhost:8081    # default - null\n  user: user                              # default - root\n  password: password                      # default - null\n  database: _system                       # default - _system\n  protocol: HTTP2_JSON                    # default - HTTP2_JSON\n  jwt: YourToken                          # default - null\n  chunksize: 3000                         # default - 30000\n  timeout: 60s                            # default - 60000 in milliseconds (1 min)\n  connection-max: 30                      # default - 1\n  connection-ttl: 2000ms                  # default - null\n  keep-alive-interval: 2000ms             # default - null\n  verify-host: true                       # default - true\n  acquire-host-list: true                 # default - false\n  acquire-host-list-interval: 1h          # default - 3600000 in millis (1 hour)\n  load-balancing-strategy: ONE_RANDOM     # default - NONE (check LoadBalancingStrategy for more)\n  response-queue-time-samples: 10         # default - 10\n```\n\nHosts can be passed to configuration as Strings (useful when passed via environment):\n\n```yaml\narangodb:\n  hosts: localhost:8080,localhost:8081    # default to host - localhost:8080\n```\n\nOr can be passed as list (useful for manual configuring):\n\n```yaml\narangodb:\n  hosts:\n    - localhost:8080\n    - localhost:8081\n```\n\n#### Configuring SSL\n\nConfigured SSLContext for ArangoDB driver.\n\nCheck for [more info](https://www.arangodb.com/docs/stable/programs-arangod-ssl.html).\n\n```yaml\narangodb:\n  ssl: \n    enabled: true                       # default - false\n    certificate:\n      enabled: true\n      value:                            # certificate as base64\n      alias: arangodb\n      type: X.509\n      algorithm: PKIX\n      key-store: jks\n      protocol: TLS\n```\n\n#### Database Initialization\n\nThere is an option to initialize database if it doesn't exist on startup via *createDatabaseIfNotExist* option.\n\nUse this option if your service is lazy initialized, to set up database for [HealthCheck](#health-check).\n\n```yaml\narangodb:\n  create-database-if-not-exist: true    # default - false\n```\n\nDefault timeout for operation set to 10000 millis, if you want to specify timeout *in seconds* for database creation\non startup you can set it via property.\n\n```yaml\narangodb:\n  create-database-timeout: 10000ms      # default - 10000\n```\n\nIn case you want to create database asynchronously you can specify that via this property:\n```yaml\narangodb:\n  create-database-async: true           # default - false\n```\n\n### Micronaut Serialization\n\nLibrary support by default [Micronaut Serialization](https://micronaut-projects.github.io/micronaut-serialization/1.0.x/guide/) module if found on classpath, \nplease check Micronaut documentation on how to configure it and use it.\n\nIn case you would like to disable [Micronaut Serialization](https://micronaut-projects.github.io/micronaut-serialization/1.0.x/guide/) for ArangoDB module only, use option below:\n```yaml\narangodb:\n  serde:\n    enabled: true     # default - true\n```\n\n### Health Check\n\nHealth check for ArangoDB is provided and is *turned on* by default.\nHeathCheck is active for database that is specified in [configuration](#configuration).\n\nArangoDB health check is part of [Micronaut Health Endpoint](https://docs.micronaut.io/latest/guide/index.html#healthEndpoint).\n\nExample of ArangoDB health:\n\n```json\n{\n  \"name\": \"service\",\n  \"status\": \"UP\",\n  \"details\": {\n    \"arangodb\": {\n      \"name\": \"arangodb\",\n      \"status\": \"UP\",\n      \"details\": {\n        \"version\": \"3.7.13\",\n        \"database\": \"_system\"\n      }\n    }\n  }\n}\n```\n\nWhere database *version* is specified and *database* name service is connected to as per [configuration](#Configuration).\n\nYou can explicitly *turn off* health check.\n\n```yaml\nendpoints:\n  health:\n    arangodb:\n      enabled: true             # default - true \n      timeout: 5000ms           # default - 5000\n      retry: 2                  # default - 2\n```\n\n#### Cluster Health Check\n\nThere is also available ArangoDB Cluster Health Check that monitors cluster health \n(if service is connected to *cluster ArangoDB*)\nand reports is *nodes* that can **not be deleted** according to [documentation](https://www.arangodb.com/docs/stable/http/cluster-health.html) from *cluster are down*, so *application is also down*.\n\nIn other case application will be *UP* and running with errors like various connection issues due to unstable cluster.\n\n**Both health checks** will be present in health output if all are enabled.\n\nArangoDB Cluster Health output example:\n\n```json\n{\n  \"name\": \"service-name\",\n  \"status\": \"DOWN\",\n  \"details\": {\n    \"arangodb-cluster\": {\n      \"name\": \"service-name\",\n      \"status\": \"DOWN\",\n      \"details\": {\n        \"clusterId\": \"752f578b-8884-47ef-8984-894ae110d259\",\n        \"version\": \"3.7.13\",\n        \"database\": \"_system\",\n        \"cluster\": [\n          {\n            \"status\": \"UP\",\n            \"nodes\": [\n              \"Coordinator0002\",\n              \"DBServer0002\",\n              \"DBServer0001\",\n              \"Agent\",\n              \"Agent Leader\",\n              \"Agent\"\n            ]\n          },\n          {\n            \"status\": \"DOWN\",\n            \"nodes\": [\n              \"Coordinator0001\"\n            ]\n          }\n        ]\n      }\n    }\n  }\n}\n```\n\nHealthCheck provides status of each node in cluster and their *ShortName* for [DBServer and Coordinator](https://www.arangodb.com/docs/stable/http/cluster-health.html)\nor *NodeID* for *Agent* nodes and flag for leading *Agent* node.\n\nYou can turn on Cluster Health Check via configuration:\n\n```yaml\nendpoints:\n  health:\n    arangodb:\n      cluster:\n        enabled: false            # default - false \n        timeout: 5000ms           # default - 5000\n        retry: 2                  # default - 2\n```\n\n## Testing\n\nFor testing purposes it is recommended to use [ArangoDB TestContainer library](https://github.com/GoodforGod/arangodb-testcontainer) \n(this project tested via that library). \n\nTestContainers allows you to use integration tests against real database in all docker friendly environments, \ncheck here for [TestContainers](https://www.testcontainers.org/).\n\n## Micronaut Compatability\n\nStarting from version *5.0.0* library ships for *Micronaut 4* and Java 17 is required.\n\nStarting from version *3.0.0* library ships for *Micronaut 3*.\n\nStarting from version *2.0.0* library ships for *Micronaut 2*.\n\nStarting from version *2.1.0* Java 11+ is required (previous version 1.8+ compatible).\n\nLast release for **Micronaut 1** is [version *1.2.1*](https://github.com/GoodforGod/micronaut-arangodb/releases/tag/v1.2.1).\n\n## License\n\nThis project licensed under the Apache License 2.0 - see the [LICENSE](LICENSE) file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgoodforgod%2Fmicronaut-arangodb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgoodforgod%2Fmicronaut-arangodb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgoodforgod%2Fmicronaut-arangodb/lists"}