{"id":13806110,"url":"https://github.com/meltmedia/dropwizard-etcd","last_synced_at":"2025-08-02T21:05:40.271Z","repository":{"id":33854519,"uuid":"37560108","full_name":"meltmedia/dropwizard-etcd","owner":"meltmedia","description":"A Dropwizard Bundle for Etcd","archived":false,"fork":false,"pushed_at":"2017-05-12T23:43:38.000Z","size":173,"stargazers_count":3,"open_issues_count":1,"forks_count":1,"subscribers_count":4,"default_branch":"develop","last_synced_at":"2024-04-14T02:21:18.579Z","etag":null,"topics":["clustering","dropwizard","dropwizard-bundle","etcd","java"],"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/meltmedia.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}},"created_at":"2015-06-16T22:49:24.000Z","updated_at":"2021-03-13T15:19:19.000Z","dependencies_parsed_at":"2022-08-27T02:38:03.978Z","dependency_job_id":null,"html_url":"https://github.com/meltmedia/dropwizard-etcd","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/meltmedia/dropwizard-etcd","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/meltmedia%2Fdropwizard-etcd","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/meltmedia%2Fdropwizard-etcd/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/meltmedia%2Fdropwizard-etcd/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/meltmedia%2Fdropwizard-etcd/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/meltmedia","download_url":"https://codeload.github.com/meltmedia/dropwizard-etcd/tar.gz/refs/heads/develop","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/meltmedia%2Fdropwizard-etcd/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267834801,"owners_count":24151642,"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","status":"online","status_checked_at":"2025-07-30T02:00:09.044Z","response_time":70,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["clustering","dropwizard","dropwizard-bundle","etcd","java"],"created_at":"2024-08-04T01:01:07.939Z","updated_at":"2025-08-02T21:05:40.206Z","avatar_url":"https://github.com/meltmedia.png","language":"Java","funding_links":[],"categories":["Open Source"],"sub_categories":["Data Stores"],"readme":"# Dropwizard Etcd\n\nA Dropwizard bundle for Etcd.\n\n[![Build Status](https://travis-ci.org/meltmedia/dropwizard-etcd.svg)](https://travis-ci.org/meltmedia/dropwizard-etcd)\n\n## Usage\n\n### Maven\n\nThis project releases to Maven Central.  To use the bundle, simply include its dependency in your project.\n\n```\n\u003cdependency\u003e\n  \u003cgroupId\u003ecom.meltmedia.dropwizard\u003c/groupId\u003e\n  \u003cartifactId\u003edropwizard-etcd\u003c/artifactId\u003e\n  \u003cversion\u003e0.3.0\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\nTo use SNAPSHOTs of this project, you will need to include the sonatype repository in your POM.\n\n```\n\u003crepositories\u003e\n    \u003crepository\u003e\n        \u003csnapshots\u003e\n        \u003cenabled\u003etrue\u003c/enabled\u003e\n        \u003c/snapshots\u003e\n        \u003cid\u003esonatype-nexus-snapshots\u003c/id\u003e\n        \u003cname\u003eSonatype Nexus Snapshots\u003c/name\u003e\n        \u003curl\u003ehttps://oss.sonatype.org/content/repositories/snapshots\u003c/url\u003e\n    \u003c/repository\u003e\n\u003c/repositories\u003e\n```\n\n### Client Bundle\n\nTo simply get access to a client for Etcd, you will need to set up the `EtcdBundle`.\n\nFirst, define the EtcdConfiguraion class somewhere in your applications configuration.\n\n```\nimport com.meltmedia.dropwizard.etcd.EtcdConfiguration;\n\n...\n\n  @JsonProperty\n  protected EtcdConfiguration etcd;\n\n  public EtcdConfiguration getEtcd() {\n    return etcd;\n  }\n```\n\nand add configuration for the client to your configuration\n\n```\netcd:\n  urls:\n    - http://localhost:2379\n  hostName: localhost\n```\n\nThen include the bundle in the `initialize` method of your application.\n\n```\nimport com.meltmedia.dropwizard.etcd.EtcdBundle;\n\n...\nprotected EtcdBundle etcdBundle;\n\n@Override\npublic void initialize(Bootstrap\u003cExampleConfiguration\u003e bootstrap) {\n  bootstrap.addBundle(etcdBundle = EtcdBundle.\u003cExampleConfiguration\u003ebuilder()\n    .withConfiguration(ExampleConfiguration::getEtcd)\n    .build());\n}\n```\n\nand access the client in your run command.\n\n```\n@Override\npublic void run(ExampleConfiguration config, Environment env) throws Exception {\n  EtcdClient client = etcdBundle.getClient();\n}\n```\n\n\n### Json Factory Bundle\n\nIf you want to get support for dealing with Etcd values as JSON, then you can additionally configure the `EtcdJsonBundle`.\n\nFirst, define the root etcd directory for your application somewhere in your configuration\n\n```\n  @JsonProperty\n  protected String etcdDirectory;\n  \n  public String getEtcdDirectory() {\n    return etcdDirectory;\n  }\n  \n  public void setEtcdDirectory( String etcdDirectory  ) {\n    this.etcdDirectory = etcdDirectory;\n  }\n```\n\nand add the directory to your configuration\n\n```\netcdDirectory: /example-app\n```\n\nThen include the bundle in the `initialize` method of your application.  Initialization will require a `ScheduledExecutorService` to be defined.\n\n```\nimport com.meltmedia.dropwizard.etcd.EtcdJsonBundle;\nimport java.util.concurrent.ScheduledExecutorService;\n\n...\nprotected EtcdJsonBundle etcdJsonBundle;\nprotected ScheduledExecutorService executor;\n\n@Override\npublic void initialize(Bootstrap\u003cExampleConfiguration\u003e bootstrap) {\n  ...\n  bootstrap.addBundle(etcdJsonBundle = EtcdJsonBundle.\u003cExampleConfiguration\u003ebuilder()\n    .withClient(etcdBundle::getClient)\n    .withExecutor(()-\u003e{return executor;})\n    .withDirectory(ExampleConfiguration::getEtcdDirectory)\n    .build());\n}\n```\n\nThen you can create DAOs, add watches and start heartbeats on Etcd.\n\n```\n@Override\npublic void run(ExampleConfiguration config, Environment env) throws Exception {\n  EtcdJson factory = etcdJsonBundle.getFactory();\n  \n  // get a handle to a directory.\n  MappedEtcdDirectory directory = factory.newDirectory(\"/dir\", new TypeReference\u003cMyType\u003e(){});\n}\n```\n\n## Cluster Bundle\n\nThe cluster bundle supports running processes across multiple instances of your application.  It requires the\n`EtcdJsonBundle` to also be installed.\n\nYou will need to add the bundle to your `initialize` method\n\n```\nimport com.meltmedia.dropwizard.etcd.cluster.ClusterBundle;\n\n...\nprotected ClusterBundle clusterBundle;\nprotected ScheduledExecutorService executor;\n\n@Override\npublic void initialize(Bootstrap\u003cExampleConfiguration\u003e bootstrap) {\n  ...\n  bootstrap.addBundle(clusterBundle = ClusterBundle.\u003cExampleConfiguration\u003ebuilder()\n    .withExecutorSupplier(()-\u003e{return executor;})\n    .withFactorySupplier(etcdJsonBundle::getFactory)\n    .build());\n}\n```\n\nthen you can get access to the cluster service from the bundle.\n\n```\n@Override\npublic void run(ExampleConfiguration config, Environment env) throws Exception {\n  ClusterService clusterService = clusterBundle.getService();\n}\n```\n\nThere is an example of using this service in [the example project](example/src/main/java/com/meltmedia/dropwizard/etcd/example/HelloProcessor.java).\n\n## Building\n\nThis project builds with Java 8 and Maven 3.  After cloning the repo, install the bundle from the root of the project.\n\n```\nmvn clean install\n```\n\n### Integration Tests\n\nRun the build with the `integration-tests` profile.\n\n```\nmvn clean install -P integration-tests\n```\n\n## Contributing\n\nThis project accepts PRs, so feel free to fork the project and send contributions back.\n\n### Formatting\n\nThis project contains formatters to help keep the code base consistent.  The formatter will update Java source files and add headers to other files.  When running the formatter, I suggest the following procedure:\n\n1. Make sure any outstanding stages are staged.  This will prevent the formatter from destroying your code.\n2. Run `mvn format`, this will format the source and add any missing license headers.\n3. If the changes look good and the project still compiles, add the formatting changes to your staged code.\n\nIf things go wrong, you can run `git checkout -- .` to drop the formatting changes. \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmeltmedia%2Fdropwizard-etcd","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmeltmedia%2Fdropwizard-etcd","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmeltmedia%2Fdropwizard-etcd/lists"}