{"id":18767993,"url":"https://github.com/riemann/riemann-java-client","last_synced_at":"2025-04-09T21:18:41.773Z","repository":{"id":2773347,"uuid":"3772264","full_name":"riemann/riemann-java-client","owner":"riemann","description":"Riemann Java Client","archived":false,"fork":false,"pushed_at":"2024-09-19T16:18:47.000Z","size":448,"stargazers_count":92,"open_issues_count":15,"forks_count":70,"subscribers_count":13,"default_branch":"main","last_synced_at":"2025-04-09T21:18:37.084Z","etag":null,"topics":["clojure","java"],"latest_commit_sha":null,"homepage":"","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/riemann.png","metadata":{"files":{"readme":"README.markdown","changelog":"CHANGES.markdown","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2012-03-20T05:48:50.000Z","updated_at":"2024-09-06T08:01:39.000Z","dependencies_parsed_at":"2025-02-23T17:10:53.513Z","dependency_job_id":"b8819c51-74bc-4c4a-8f88-94e31d9313e6","html_url":"https://github.com/riemann/riemann-java-client","commit_stats":null,"previous_names":[],"tags_count":24,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/riemann%2Friemann-java-client","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/riemann%2Friemann-java-client/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/riemann%2Friemann-java-client/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/riemann%2Friemann-java-client/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/riemann","download_url":"https://codeload.github.com/riemann/riemann-java-client/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248111973,"owners_count":21049578,"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":["clojure","java"],"created_at":"2024-11-07T19:10:03.067Z","updated_at":"2025-04-09T21:18:41.741Z","avatar_url":"https://github.com/riemann.png","language":"Java","readme":"# Getting started\n\nThis project encompasses:\n\n1. A Java client for the Riemann protocol\n2. The Riemann protocol buffer definition, and\n3. Its corresponding (auto-generated) Java classes\n\n[![Clojars\nProject](https://img.shields.io/clojars/v/io.riemann/riemann-java-client.svg)](https://clojars.org/io.riemann/riemann-java-client)\n\n[![Riemann Clojure Client testing](https://github.com/riemann/riemann-java-client/actions/workflows/test.yml/badge.svg)](https://github.com/riemann/riemann-java-client/actions/workflows/test.yml)\n\n## Artifacts\n\nArtifacts are available through\n[clojars](https://clojars.org/io.riemann/riemann-java-client) which you can add\nto your maven repository like so:\n\n```xml\n\u003crepository\u003e\n  \u003cid\u003eclojars.org\u003c/id\u003e\n  \u003curl\u003ehttp://clojars.org/repo\u003c/url\u003e\n\u003c/repository\u003e\n```\n\n**Note:**\nThe namespace for the client was previously `com.aphyr` but has been\nrenamed to `io.riemann` since the 0.4.2 release. You need to update your\ndependencies.\n\n## Example\n\n``` java\nRiemannClient c = RiemannClient.tcp(\"my.riemann.server\", 5555);\nc.connect();\nc.event().\n  service(\"fridge\").\n  state(\"running\").\n  metric(5.3).\n  tags(\"appliance\", \"cold\").\n  send().\n  deref(5000, java.util.concurrent.TimeUnit.MILLISECONDS);\n\nc.query(\"tagged \\\"cold\\\" and metric \u003e 0\").deref(); // =\u003e List\u003cEvent\u003e;\nc.close();\n```\n\nClients will automatically attempt to reconnect every 5 seconds. Writes\nwill fail instantaneously when no connection is available.\n\n`.send()` proceeds asynchronously and returns as soon as Netty flushes\nthe write possible. `.send()` returns a\n`io.riemann.riemann.client.IPromise` containing the response from the\nwrite (which also supports Clojure's Deref protocol). If you do not\nderef this promise, the client makes *no* guarantees about event\ndelivery: it will, for example, discard writes when there are too many\nmessages outstanding on the wire, when Riemann cannot keep up with load,\nand so on. You *should* deref sends at some point, if for no other\nreason than to handle backpressure.\n\nCalling `.deref()` will throw a ServerError if the server responds with\nan error, or other Runtime/IOExceptions for error conditions, like a\nchannel being disconnected, etc.\n\n```java\ntry {\n  if (!c.event().\n      service(\"fridge\").\n      state(\"running\").\n      send().\n      deref(1, java.util.concurrent.TimeUnit.SECONDS)) {\n    throw new IOException(\"Timed out.\")\n  }\n} catch (Exception e) {\n  retry();\n}\n```\n\nThis code blocks for 1 second before retrying, returns a Message if the\nwrite succeeded, null if the promise is still outstanding, and throws if\na failure is known to have occurred. This means you can send multiple\ncopies of an event if latencies exceed 1000 ms. There is no reliable way\nto distinguish between failure and delay in an asynchronous network, so\nthink ahead. `.deref()` blocks indefinitely, but will return as soon as\nthe Netty connection fails, so it may be the safest option when\narbitrary delays are acceptable.\n\nEach client allows thousands of outstanding concurrent requests at any\ntime, so a small number of threads can efficiently pipeline many\noperations over the same client. I suggest performing writes on a\nspecial monitoring thread or threads, and pushing the response futures\nonto a threadpoolexecutor for `deref`ing.\n\nFor higher performance (by orders of magnitude) you can also send\nmultiple events batched in a single message. Use\n`RiemannClient.sendEvents(...)` to send multiple events at once.\n\nTo automatically batch events, wrap any IRiemannClient in a\nRiemannBatchClient, which automatically bundles events together into\nmessages for you.\n\n# Release and deployment\n\n1. Increment the version.\n\n2. Compile the client.\n\n```sh\nmvn compile -rf :riemann-java-client\n```\n\n3. Deploy the client.\n\n```sh\nmvn deploy -tf :riemann-java-client-parent\nmvn deploy -rf :riemann-java-client\n```\n\n# Hacking\n\nYou'll need [protobuf 3.16.1](https://github.com/google/protobuf) - you\ncan just install the `protoc` binary. After that, `mvn package` should\nbuild a JAR, and `mvn install` will drop it in your local repository.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Friemann%2Friemann-java-client","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Friemann%2Friemann-java-client","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Friemann%2Friemann-java-client/lists"}