{"id":13807605,"url":"https://github.com/reactiverse/consul-cluster-manager","last_synced_at":"2025-05-05T10:31:26.362Z","repository":{"id":44220979,"uuid":"169048532","full_name":"reactiverse/consul-cluster-manager","owner":"reactiverse","description":"Consul - based cluster manager that can be plugged into Vert.x ecosystem.","archived":false,"fork":false,"pushed_at":"2023-12-05T22:20:17.000Z","size":96,"stargazers_count":20,"open_issues_count":9,"forks_count":3,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-04-08T21:23:43.358Z","etag":null,"topics":["cluster-manager","clustering","consul","distributed-counter","distributed-lock","distributed-map","vertx"],"latest_commit_sha":null,"homepage":null,"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/reactiverse.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}},"created_at":"2019-02-04T08:33:37.000Z","updated_at":"2024-09-11T07:00:32.000Z","dependencies_parsed_at":"2024-01-15T09:07:30.017Z","dependency_job_id":"258f9599-9e3e-46db-b504-bf9435ec7b64","html_url":"https://github.com/reactiverse/consul-cluster-manager","commit_stats":{"total_commits":29,"total_committers":5,"mean_commits":5.8,"dds":"0.27586206896551724","last_synced_commit":"39cc0145fb68551b25243eee5b8ab57ffcf80abf"},"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reactiverse%2Fconsul-cluster-manager","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reactiverse%2Fconsul-cluster-manager/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reactiverse%2Fconsul-cluster-manager/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reactiverse%2Fconsul-cluster-manager/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/reactiverse","download_url":"https://codeload.github.com/reactiverse/consul-cluster-manager/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252480460,"owners_count":21754777,"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":["cluster-manager","clustering","consul","distributed-counter","distributed-lock","distributed-map","vertx"],"created_at":"2024-08-04T01:01:27.510Z","updated_at":"2025-05-05T10:31:25.971Z","avatar_url":"https://github.com/reactiverse.png","language":"Java","funding_links":[],"categories":["Cluster Managers"],"sub_categories":[],"readme":"# Consul cluster manager for Vert.x ecosystem #\n\n[![Build Status](https://travis-ci.org/reactiverse/consul-cluster-manager.svg?branch=master)](https://travis-ci.com/reactiverse/consul-cluster-manager)\n\n**Introduction**\n-\n\nConsul - based cluster manager that is plugable into Vert.x ecosystem. **[Consul](https://www.consul.io/)** is a distributed, highly available, and data center aware solution to connect and configure applications across dynamic, distributed infrastructure.\n\n**Motivation**\n-\nAs we all know Vert.x cluster managers are pluggable and so far we have 6 cluster manager implementations:\n\n- Hazelcast - based: https://vertx.io/docs/vertx-hazelcast/java/\n- Apache Zookeeper - based: https://vertx.io/docs/vertx-zookeeper/java/\n- Apache Ignite - based: https://vertx.io/docs/vertx-ignite/java/\n- JGroups - based: https://github.com/vert-x3/vertx-jgroups\n- Atomix - based : https://github.com/atomix/atomix-vertx\n- Infinispan - based : https://github.com/vert-x3/vertx-infinispan\n\nIf you are already using Consul along with Vert.x within your system - it might be a good fit to use Consul directly as main manager for :\n- discovery and group membership of Vert.x nodes in a cluster\nMaintaining cluster wide topic subscriber lists (so we know which nodes are interested in which event bus addresses)\n- distributed map support;\n- distributed locks;\n- distributed counters;\n\nNote : Cluster managers do not handle the event bus inter-node transport, this is done directly by Vert.x with TCP connections.\n\n**Implementation details**\n-\nCurrent consul cluster manager implementation is fully based on [**vertx-consul-client**](https://vertx.io/docs/vertx-consul-client/java/) and [**vertx-core**](https://vertx.io/docs/vertx-core/java/).\n\n**How to use**\n-\nVersion compatibility matrix\n\n| Cluster manager  | Vert.x |\n| ---------------- | ------ |\n|  0.1.0           | 3.6.0  |\n|  0.2.0           | 3.6.1  |\n|  0.3.0           | 3.6.2  |\n|  0.4.0           | 3.6.3  |\n|  1.0.0           | 3.7.0  |\n|  1.1.0           | 3.7.1  |\n|  1.2.0           | 3.8.0  |\n|  1.2.1           | 3.8.1  |\n|  1.2.2           | 3.8.2  |\n|  3.9.1           | 3.9.1  |\n\n### Gradle\n```groovy\ncompile 'io.reactiverse:consul-cluster-manager:${cluster-manager-version}'\n```\n\n### Maven\n```xml\n\u003cdependency\u003e\n  \u003cgroupId\u003eio.reactiverse\u003c/groupId\u003e\n  \u003cartifactId\u003econsul-cluster-manager\u003c/artifactId\u003e\n  \u003cversion\u003e${cluster-manager-version}\u003c/version\u003e\n\u003c/dependency\u003e\n```\nThere's more than one way to create an instance of consul cluster manager.\n- Defaut one:\n\n``` ConsulClusterManager consulClusterManager = new ConsulClusterManager(); // Consul agent should be running then on localhost:8500.  ```\n- Excplicilty specifying configuration:\n```\nJsonObject options = new JsonObject()\n.put(\"host\", \"consulAgentHost\") // host on which consul agent is running, if not specified default host will be used which is \"localhost\".\n.put(\"port\", consulAgentPort) // port on wich consul agent is runing, if not specified default port will be used which is \"8500\".\n/*\n * There's an option to utilize built-in internal caching.\n * @{Code false} - enable internal caching of event bus subscribers - this will give us better latency but stale reads (stale subsribers) might appear.\n * @{Code true} - disable internal caching of event bus subscribers - this will give us stronger consistency in terms of fetching event bus subscribers,\n * but this will result in having much more round trips to consul kv store where event bus subs are being kept.\n */\n.put(\"preferConsistency\", false)\n/*\n * Option to provide custom service name which is visible on web ui\n */\n.put(\"serviceName\", \"my-custom-service\")\n/*\n * There's also an option to specify explictly host address on which given cluster manager will be operating on.\n * By defult InetAddress.getLocalHost().getHostAddress() will be executed.\n * Linux systems enumerate the loopback network interface the same way as regular LAN network interfaces, but the JDK\n * InetAddress.getLocalHost method does not specify the algorithm used to select the address returned under such circumstances, and will\n * often return the loopback address, which is not valid for network communication.\n */\n .put(\"nodeHost\", \"10.0.0.1\");\n // consul client options can be additionally specified as needed.\nConsulClusterManager consulClusterManager = new ConsulClusterManager(options);\n ```\n- Once cluster manager instance is created we can easily create clustered vertx. Voilà!\n```\nVertxOptions vertxOptions = new VertxOptions();\nvertxOptions.setClusterManager(consulClusterManager);\nVertx.clusteredVertx(vertxOptions, res -\u003e {\n    if (res.succeeded()) {\n\t    // clustered vertx instance has been successfully created!\n\t    Vertx vertx = res.result();\n\t} else {\n\t    // something went wrong :(\n\t}\n}\n```\n\n**Restrictions**\n-\n- Compliant with **ONLY Vert.x 3.6.0+** release.\n- The limit on a key's value size of any of the consul  maps is 512KB.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Freactiverse%2Fconsul-cluster-manager","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Freactiverse%2Fconsul-cluster-manager","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Freactiverse%2Fconsul-cluster-manager/lists"}