{"id":13509550,"url":"https://github.com/peburrows/kane","last_synced_at":"2025-12-11T23:45:47.187Z","repository":{"id":3571452,"uuid":"50158916","full_name":"peburrows/kane","owner":"peburrows","description":"Google Pub/Sub client for Elixir","archived":false,"fork":false,"pushed_at":"2023-08-25T23:43:10.000Z","size":114,"stargazers_count":104,"open_issues_count":13,"forks_count":44,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-04-13T22:00:11.033Z","etag":null,"topics":["elixir","gcp","google-cloud-platform","google-cloud-pubsub","pubsub"],"latest_commit_sha":null,"homepage":"http://hexdocs.pm/kane","language":"Elixir","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/peburrows.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}},"created_at":"2016-01-22T05:04:37.000Z","updated_at":"2023-12-13T01:05:54.000Z","dependencies_parsed_at":"2023-02-15T22:20:25.852Z","dependency_job_id":"d18f079a-ebd1-472a-b099-f55ec6f58242","html_url":"https://github.com/peburrows/kane","commit_stats":{"total_commits":101,"total_committers":19,"mean_commits":5.315789473684211,"dds":0.3564356435643564,"last_synced_commit":"08aca7e395d8f15fd0bc40c35266eccdda057d35"},"previous_names":["peburrows/murdoch"],"tags_count":16,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peburrows%2Fkane","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peburrows%2Fkane/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peburrows%2Fkane/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peburrows%2Fkane/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/peburrows","download_url":"https://codeload.github.com/peburrows/kane/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246324082,"owners_count":20759073,"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":["elixir","gcp","google-cloud-platform","google-cloud-pubsub","pubsub"],"created_at":"2024-08-01T02:01:09.432Z","updated_at":"2025-12-11T23:45:42.152Z","avatar_url":"https://github.com/peburrows.png","language":"Elixir","funding_links":[],"categories":["Third Party APIs"],"sub_categories":[],"readme":"[![Build Status](https://travis-ci.org/peburrows/kane.svg?branch=master)](https://travis-ci.org/peburrows/kane)\n\n# Kane\n\nKane. Citizen Kane. Charles Foster Kane, to be exact, Publisher extraordinaire. Rosebud.\n\nKane is for publishing and subscribing to topics using Google Cloud Pub/Sub.\n\n## Installation\n\n1. Add Kane to your list of dependencies in `mix.exs`:\n\n```elixir\ndef deps do\n  [{:kane, \"~\u003e 0.9.0\"}]\nend\n```\n\n2. Configure [Goth](https://github.com/peburrows/goth) (Kane's underlying token storage and retrieval library) with your Google JSON credentials.\n\n## Usage\n\nPull, process and acknowledge messages via a pre-existing subscription:\n\n```elixir\n{:ok, token} = Goth.fetch(MyApp.Goth)\n\nkane = %Kane{\n  project_id: my_app_gcp_credentials[\"project_id\"],\n  token: token\n}\n\nsubscription = %Kane.Subscription{\n                  name: \"my-sub\",\n                  topic: %Kane.Topic{\n                    name: \"my-topic\"\n                  }\n                }\n\n{:ok, messages} = Kane.Subscription.pull(kane, subscription)\n\nEnum.each messages, fn(mess)-\u003e\n  process_message(mess)\nend\n\n# acknowledge message receipt in bulk\nKane.Subscription.ack(kane, subscription, messages)\n```\n\nSend message via pre-existing subscription:\n\n```elixir\ntopic   = %Kane.Topic{name: \"my-topic\"}\nmessage = %Kane.Message{data: %{\"hello\": \"world\"}, attributes: %{\"random\" =\u003e \"attr\"}}\n\nresult  = Kane.Message.publish(kane, message, topic)\n\ncase result do\n  {:ok, _return}    -\u003e IO.puts(\"It worked!\")\n  {:error, _reason} -\u003e IO.puts(\"Should we try again?\")\nend\n```\n\nHints:\n\n- Attributes have to be Strings (https://cloud.google.com/pubsub/docs/reference/rest/v1/PubsubMessage)\n- We base64-encode the message by default (only mandatory when using json - https://cloud.google.com/pubsub/publisher)\n\nFor more details, see the [documentation](http://hexdocs.pm/kane).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpeburrows%2Fkane","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpeburrows%2Fkane","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpeburrows%2Fkane/lists"}