{"id":47936159,"url":"https://github.com/faiscadev/fila-java","last_synced_at":"2026-04-04T07:43:15.720Z","repository":{"id":339797656,"uuid":"1162225043","full_name":"faiscadev/fila-java","owner":"faiscadev","description":"Java client SDK for Fila message broker","archived":false,"fork":false,"pushed_at":"2026-03-28T22:32:32.000Z","size":161,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-04-04T07:43:10.375Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/faiscadev.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-02-20T02:14:03.000Z","updated_at":"2026-03-28T22:32:35.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/faiscadev/fila-java","commit_stats":null,"previous_names":["faiscadev/fila-java"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/faiscadev/fila-java","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/faiscadev%2Ffila-java","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/faiscadev%2Ffila-java/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/faiscadev%2Ffila-java/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/faiscadev%2Ffila-java/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/faiscadev","download_url":"https://codeload.github.com/faiscadev/fila-java/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/faiscadev%2Ffila-java/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31392186,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-04T04:26:24.776Z","status":"ssl_error","status_checked_at":"2026-04-04T04:23:34.147Z","response_time":60,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":[],"created_at":"2026-04-04T07:43:14.932Z","updated_at":"2026-04-04T07:43:15.699Z","avatar_url":"https://github.com/faiscadev.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# fila-client (Java)\n\nJava client SDK for the [Fila](https://github.com/faiscadev/fila) message broker.\n\n## Installation\n\n### Gradle\n\n```groovy\nimplementation 'dev.faisca:fila-client:0.1.0'\n```\n\n### Maven\n\n```xml\n\u003cdependency\u003e\n    \u003cgroupId\u003edev.faisca\u003c/groupId\u003e\n    \u003cartifactId\u003efila-client\u003c/artifactId\u003e\n    \u003cversion\u003e0.1.0\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\n## Usage\n\n```java\nimport dev.faisca.fila.*;\nimport java.util.Map;\n\ntry (FilaClient client = FilaClient.builder(\"localhost:5555\").build()) {\n    // Enqueue a message\n    String msgId = client.enqueue(\"my-queue\", Map.of(\"tenant\", \"acme\"), \"hello\".getBytes());\n    System.out.println(\"Enqueued: \" + msgId);\n\n    // Consume messages\n    ConsumerHandle handle = client.consume(\"my-queue\", msg -\u003e {\n        System.out.println(\"Received: \" + new String(msg.getPayload()));\n        client.ack(\"my-queue\", msg.getId());\n    });\n\n    // ... do other work ...\n\n    // Stop consuming\n    handle.cancel();\n}\n```\n\n## TLS\n\n### System trust store (public CAs)\n\nIf the Fila server uses a certificate issued by a public CA (e.g., Let's Encrypt), enable TLS with the JVM's default trust store:\n\n```java\ntry (FilaClient client = FilaClient.builder(\"localhost:5555\")\n    .withTls()\n    .build()) {\n    // use client...\n}\n```\n\n### Custom CA certificate\n\nFor servers using self-signed or private CA certificates, provide the CA cert explicitly:\n\n```java\nbyte[] caCert = Files.readAllBytes(Path.of(\"ca.pem\"));\n\ntry (FilaClient client = FilaClient.builder(\"localhost:5555\")\n    .withTlsCaCert(caCert)\n    .build()) {\n    // use client...\n}\n```\n\n### Mutual TLS (mTLS)\n\nFor mutual TLS, also provide the client certificate and key. This works with both trust modes:\n\n```java\nbyte[] caCert = Files.readAllBytes(Path.of(\"ca.pem\"));\nbyte[] clientCert = Files.readAllBytes(Path.of(\"client.pem\"));\nbyte[] clientKey = Files.readAllBytes(Path.of(\"client-key.pem\"));\n\ntry (FilaClient client = FilaClient.builder(\"localhost:5555\")\n    .withTlsCaCert(caCert)\n    .withTlsClientCert(clientCert, clientKey)\n    .build()) {\n    // use client...\n}\n```\n\n## API Key Authentication\n\nWhen the server has auth enabled, provide an API key:\n\n```java\ntry (FilaClient client = FilaClient.builder(\"localhost:5555\")\n    .withApiKey(\"your-api-key\")\n    .build()) {\n    // use client...\n}\n```\n\nThe key is sent as a `Bearer` token in the `authorization` metadata header on every RPC.\n\nTLS and API key auth can be combined:\n\n```java\ntry (FilaClient client = FilaClient.builder(\"localhost:5555\")\n    .withTlsCaCert(caCert)\n    .withTlsClientCert(clientCert, clientKey)\n    .withApiKey(\"your-api-key\")\n    .build()) {\n    // use client...\n}\n```\n\n## API Reference\n\n### `FilaClient`\n\nCreate a client with the builder:\n\n```java\nFilaClient client = FilaClient.builder(\"localhost:5555\").build();\n```\n\n`FilaClient` implements `AutoCloseable` for use with try-with-resources.\n\n#### Builder Methods\n\n| Method | Description |\n|--------|-------------|\n| `withTls()` | Enable TLS using JVM's default trust store (cacerts) |\n| `withTlsCaCert(byte[] caCertPem)` | CA certificate for TLS server verification (implies `withTls()`) |\n| `withTlsClientCert(byte[] certPem, byte[] keyPem)` | Client cert + key for mTLS |\n| `withApiKey(String apiKey)` | API key sent as `Bearer` token on every RPC |\n\nAll builder methods are optional. When none are set, the client connects over plaintext without authentication (backward compatible).\n\n#### `enqueue(String queue, Map\u003cString, String\u003e headers, byte[] payload) -\u003e String`\n\nEnqueue a message. Returns the broker-assigned message ID (UUIDv7).\n\nThrows `QueueNotFoundException` if the queue does not exist.\n\n#### `consume(String queue, Consumer\u003cConsumeMessage\u003e handler) -\u003e ConsumerHandle`\n\nStart consuming messages from a queue. Messages are delivered to the handler on a background thread. Nacked messages are redelivered on the same stream.\n\nCall `handle.cancel()` to stop consuming.\n\nThrows `QueueNotFoundException` if the queue does not exist.\n\n#### `ack(String queue, String msgId)`\n\nAcknowledge a successfully processed message.\n\nThrows `MessageNotFoundException` if the message does not exist.\n\n#### `nack(String queue, String msgId, String error)`\n\nNegatively acknowledge a message. The message is requeued based on the queue's configuration.\n\nThrows `MessageNotFoundException` if the message does not exist.\n\n### `ConsumeMessage`\n\n| Method             | Type                  | Description                          |\n|--------------------|-----------------------|--------------------------------------|\n| `getId()`          | `String`              | Broker-assigned message ID (UUIDv7)  |\n| `getHeaders()`     | `Map\u003cString, String\u003e` | Message headers                      |\n| `getPayload()`     | `byte[]`              | Message payload                      |\n| `getFairnessKey()` | `String`              | Fairness key assigned by the broker  |\n| `getAttemptCount()` | `int`                | Number of delivery attempts          |\n| `getQueue()`       | `String`              | Queue this message belongs to        |\n\n### Error Handling\n\nAll exceptions extend `FilaException` (unchecked):\n\n- `QueueNotFoundException` — queue does not exist\n- `MessageNotFoundException` — message does not exist (or already acked)\n- `RpcException` — unexpected gRPC failure (includes status code via `getCode()`)\n\n```java\ntry {\n    client.enqueue(\"missing-queue\", Map.of(), \"data\".getBytes());\n} catch (QueueNotFoundException e) {\n    System.err.println(\"Queue not found: \" + e.getMessage());\n}\n```\n\n## License\n\nAGPLv3 — see [LICENSE](LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffaiscadev%2Ffila-java","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffaiscadev%2Ffila-java","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffaiscadev%2Ffila-java/lists"}