{"id":47936131,"url":"https://github.com/faiscadev/fila-go","last_synced_at":"2026-04-04T07:43:11.674Z","repository":{"id":339797611,"uuid":"1162197562","full_name":"faiscadev/fila-go","owner":"faiscadev","description":"Go client SDK for the Fila message broker","archived":false,"fork":false,"pushed_at":"2026-04-04T00:57:52.000Z","size":136,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-04-04T07:43:06.044Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","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-20T01:10:57.000Z","updated_at":"2026-03-28T22:32:19.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/faiscadev/fila-go","commit_stats":null,"previous_names":["faiscadev/fila-go"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/faiscadev/fila-go","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/faiscadev%2Ffila-go","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/faiscadev%2Ffila-go/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/faiscadev%2Ffila-go/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/faiscadev%2Ffila-go/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/faiscadev","download_url":"https://codeload.github.com/faiscadev/fila-go/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/faiscadev%2Ffila-go/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:10.817Z","updated_at":"2026-04-04T07:43:11.655Z","avatar_url":"https://github.com/faiscadev.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# fila-go\n\nGo client SDK for the [Fila](https://github.com/faisca/fila) message broker.\n\n## Installation\n\n```bash\ngo get github.com/faisca/fila-go\n```\n\n## Usage\n\n```go\npackage main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"log\"\n\n\tfila \"github.com/faisca/fila-go\"\n)\n\nfunc main() {\n\tclient, err := fila.Dial(\"localhost:5555\")\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tdefer client.Close()\n\n\tctx := context.Background()\n\n\t// Enqueue a message.\n\tmsgID, err := client.Enqueue(ctx, \"my-queue\", map[string]string{\n\t\t\"tenant\": \"acme\",\n\t}, []byte(\"hello world\"))\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tfmt.Println(\"Enqueued:\", msgID)\n\n\t// Consume messages.\n\tch, err := client.Consume(ctx, \"my-queue\")\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tfor msg := range ch {\n\t\tfmt.Printf(\"Received: %s (attempt %d)\\n\", msg.ID, msg.AttemptCount)\n\n\t\t// Acknowledge successful processing.\n\t\tif err := client.Ack(ctx, \"my-queue\", msg.ID); err != nil {\n\t\t\t// Negative acknowledge on failure.\n\t\t\tclient.Nack(ctx, \"my-queue\", msg.ID, err.Error())\n\t\t}\n\t}\n}\n```\n\n## TLS\n\nIf the broker's certificate is issued by a public CA (e.g., Let's Encrypt) or a\nCA already in the operating system's trust store, enable TLS with no arguments:\n\n```go\nclient, err := fila.Dial(\"broker.example.com:5555\",\n    fila.WithTLS(),\n)\n```\n\nFor self-signed certificates or private CAs not in the system trust store,\nprovide the CA certificate explicitly:\n\n```go\ncaCert, err := os.ReadFile(\"ca.crt\")\nif err != nil {\n    log.Fatal(err)\n}\nclient, err := fila.Dial(\"localhost:5555\",\n    fila.WithTLSCACert(caCert),\n)\n```\n\nFor mutual TLS (mTLS), also provide the client certificate and key:\n\n```go\ncaCert, err := os.ReadFile(\"ca.crt\")\nif err != nil {\n    log.Fatal(err)\n}\nclientCert, err := os.ReadFile(\"client.crt\")\nif err != nil {\n    log.Fatal(err)\n}\nclientKey, err := os.ReadFile(\"client.key\")\nif err != nil {\n    log.Fatal(err)\n}\n\nclient, err := fila.Dial(\"localhost:5555\",\n    fila.WithTLSCACert(caCert),\n    fila.WithTLSClientCert(clientCert, clientKey),\n)\n```\n\n## API Key Authentication\n\nConnect to an auth-enabled broker by providing an API key:\n\n```go\nclient, err := fila.Dial(\"localhost:5555\",\n    fila.WithAPIKey(\"your-api-key\"),\n)\n```\n\nTLS and API key auth can be combined:\n\n```go\nclient, err := fila.Dial(\"localhost:5555\",\n    fila.WithTLSCACert(caCert),\n    fila.WithTLSClientCert(clientCert, clientKey),\n    fila.WithAPIKey(\"your-api-key\"),\n)\n```\n\n## API\n\n### `fila.Dial(addr string, opts ...DialOption) (*Client, error)`\n\nConnect to a Fila broker. Connection is established lazily on the first RPC call.\n\n### Options\n\n- `fila.WithTLS()` — Enable TLS using the system's default root CA pool\n- `fila.WithTLSCACert(caCertPEM []byte)` — Enable TLS with a custom CA certificate for verifying the server\n- `fila.WithTLSClientCert(certPEM, keyPEM []byte)` — Client certificate and key for mTLS (requires `WithTLS` or `WithTLSCACert`)\n- `fila.WithAPIKey(key string)` — API key sent as `Bearer` token on every RPC\n- `fila.WithGRPCDialOption(opt grpc.DialOption)` — Raw gRPC dial option for advanced configuration\n\n### `client.Enqueue(ctx, queue, headers, payload) (string, error)`\n\nEnqueue a message. Returns the broker-assigned message ID.\n\n### `client.Consume(ctx, queue) (\u003c-chan *ConsumeMessage, error)`\n\nOpen a streaming consumer. Returns a channel that delivers messages as they become available. The channel is closed when the stream ends or the context is cancelled.\n\n### `client.Ack(ctx, queue, msgID) error`\n\nAcknowledge a successfully processed message. The message is permanently removed.\n\n### `client.Nack(ctx, queue, msgID, errMsg) error`\n\nNegatively acknowledge a failed message. The message is requeued or routed to the dead-letter queue based on the queue's configuration.\n\n## Error Handling\n\nPer-operation sentinel errors are checkable via `errors.Is`:\n\n```go\n_, err := client.Enqueue(ctx, \"missing-queue\", nil, []byte(\"test\"))\nif errors.Is(err, fila.ErrQueueNotFound) {\n    // handle queue not found\n}\n\nerr = client.Ack(ctx, \"my-queue\", \"missing-id\")\nif errors.Is(err, fila.ErrMessageNotFound) {\n    // handle message not found\n}\n```\n\n## License\n\nAGPLv3\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffaiscadev%2Ffila-go","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffaiscadev%2Ffila-go","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffaiscadev%2Ffila-go/lists"}