{"id":29053626,"url":"https://github.com/efcasado/pulsar-elixir","last_synced_at":"2026-05-30T08:03:41.171Z","repository":{"id":259609965,"uuid":"878898192","full_name":"efcasado/pulsar-elixir","owner":"efcasado","description":"An Elixir client for Apache Pulsar.","archived":false,"fork":false,"pushed_at":"2026-05-21T19:58:34.000Z","size":440,"stargazers_count":4,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"main","last_synced_at":"2026-05-22T04:59:39.726Z","etag":null,"topics":["elixir","pulsar"],"latest_commit_sha":null,"homepage":"","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/efcasado.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2024-10-26T12:14:17.000Z","updated_at":"2026-05-21T19:58:36.000Z","dependencies_parsed_at":"2025-06-27T01:07:21.258Z","dependency_job_id":"c8707fbe-d1a1-4428-a112-27240738e65b","html_url":"https://github.com/efcasado/pulsar-elixir","commit_stats":null,"previous_names":["efcasado/pulsar-elixir"],"tags_count":42,"template":false,"template_full_name":null,"purl":"pkg:github/efcasado/pulsar-elixir","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/efcasado%2Fpulsar-elixir","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/efcasado%2Fpulsar-elixir/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/efcasado%2Fpulsar-elixir/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/efcasado%2Fpulsar-elixir/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/efcasado","download_url":"https://codeload.github.com/efcasado/pulsar-elixir/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/efcasado%2Fpulsar-elixir/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33684419,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-05-30T02:00:06.278Z","response_time":92,"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":["elixir","pulsar"],"created_at":"2025-06-27T01:07:15.321Z","updated_at":"2026-05-30T08:03:41.165Z","avatar_url":"https://github.com/efcasado.png","language":"Elixir","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Elixir Client for Apache Pulsar\n\n[![CI](https://github.com/efcasado/pulsar-elixir/actions/workflows/ci.yml/badge.svg)](https://github.com/efcasado/pulsar-elixir/actions/workflows/ci.yml)\n[![Coverage Status](https://coveralls.io/repos/github/efcasado/pulsar-elixir/badge.svg?branch=main)](https://coveralls.io/github/efcasado/pulsar-elixir?branch=main)\n[![Package Version](https://img.shields.io/hexpm/v/pulsar_elixir.svg)](https://hex.pm/packages/pulsar_elixir)\n[![hexdocs.pm](https://img.shields.io/badge/hex-docs-purple.svg)](https://hexdocs.pm/pulsar_elixir/)\n\n\n\u003e [!TIP]\n\u003e Using [Broadway](https://github.com/dashbitco/broadway)? Check out the companion project: [off_broadway_pulsar](https://github.com/efcasado/off_broadway_pulsar).\n\nAn Elixir client for [Apache Pulsar](https://pulsar.apache.org/).\n\n\n## Installation\n\nAdd `:pulsar_elixir` to your dependencies in `mix.exs`:\n\n```elixir\ndef deps do\n  [\n    {:pulsar, \"~\u003e 2.8.18\", hex: :pulsar_elixir}\n  ]\nend\n```\n\n\n## Quick Start\n\nAssuming you have Pulsar running on `localhost:6650`, the quickest way to consume messages\nfrom a Pulsar topic is using the Reader interace as shown below\n\n```elixir\n\"persistent://my-tenant/my-namespace/my-topic\"\n|\u003e Pulsar.Reader.stream(host: \"pulsar://localhost:6650\", timeout: 100)\n|\u003e Enum.map(fn msg -\u003e String.to_integer(msg.payload) end)\n|\u003e Enum.filter(fn n -\u003e rem(n, 2) == 0 end)\n|\u003e Enum.map(fn n -\u003e n * 2 end)\n```\n\nFor more complex scenarios and assuming that you have implemented a basic consumer like the\none below:\n\n```elixir\ndefmodule MyPulsarConsumer do\n  use Pulsar.Consumer.Callback\n\n  def handle_message(message, state) do\n    IO.puts(\"Received: #{message.payload}\")\n    {:ok, state}\n  end\nend\n```\n\nYou can start producing and consuming messages with the following configuration:\n\n```elixir\nconfig :pulsar,\n  host: \"pulsar://localhost:6650\",\n  consumers: [\n    my_consumer: [\n        topic: \"persistent://my-tenant/my-namespace/my-topic\",\n        subscription_name: \"my-subscription\",\n        callback_module: MyPulsarConsumer\n    ]\n  ],\n  producers: [\n    my_producer: [\n        topic: \"persistent://my-tenant/my-namespace/my-topic\"\n    ]\n  ]\n```\n\nSending a message using the configured producer can be done as follows:\n\n```elixir\nPulsar.send(:my_producer, \"Hello, Pulsar!\")\n```\n\nBy default, brokers, consumers and producers are started within the scope of the\n`:default` client, but you can also configure multiple clients (which may come in\nhandy if you need to connect to multiple clusters).\n\n```elixir\nclients: [\n  client_1: [\n      host: \"pulsar://host.cluster1.com:6650\"\n  ],\n  client_2: [\n      host: \"pulsar://host.cluster2.com:6650\"\n  ]\n]\n```\n\nThen, you can specify the client in the consumer or producer configuration using\nthe `client` key, eg. `client: :client_1`.\n\n```elixir\nproducers: [\n  my_producer_1: [\n    client: :client_1\n    topic: \"persistent://my-tenant/my-namespace/my-topic\"\n  ]\n]\n```\n\nIf your Pulsar cluster requires authentication, you can configure it in the client\nusing the `auth` key:\n\n```elixir\nauth: [\n  type: Pulsar.Auth.OAuth2,\n  opts: [\n    client_id: \"\u003cYOUR-OAUTH2-CLIENT-ID\u003e\",\n    client_secret: \"\u003cYOUR-OAUTH2-CLIENT-SECRET\u003e\",\n    site: \"\u003cYOUR-OAUTH2-ISSUER-URL\u003e\",\n    audience: \"\u003cYOUR-OAUTH2-AUDIENCE\u003e\"\n  ]\n]\n```\n\n\n## Testing\n\n\u003e [!IMPORTANT]\n\u003e Do not forget to add the following line to your `/etc/hosts` file before running the tests:\n\u003e\n\u003e ```\n\u003e 127.0.0.1 broker1 broker2\n\u003e ```\n\nTo run the tests, run the following command:\n\n```\nmix test\n```\n\nIf you want to run only a subset of tests, specify the file including the tests you want to run\n\n```\nmix test test/integration/consumer_test.exs\n```\n\nYou can also run individual tests by passing the line number where they are defined\n\n```\nmix test test/integration/consumer_test.exs:43\n```\n\nThe `examples` directory includes a number of examples that demonstrate the use of the Pulsar client.\nFor example:\n\n```\nmix run --no-start examples/bingo.exs\n```\n\n\n## Features\n\nThe full feature matrix for Apache Pulsar can be found [here](https://pulsar.apache.org/client-feature-matrix/).\n\n| Component | Feature                            | Supported |\n|-----------|------------------------------------|-----------|\n| Client    | TLS encryption                     | ✅        |\n| Client    | Authentication                     | ⚠️        |\n| Client    | Transaction                        | ❌        |\n| Client    | Statistics                         | ❌        |\n| Producer  | Sync send                          | ✅        |\n| Producer  | Async send                         | ❌        |\n| Producer  | Batching                           | ✅        |\n| Producer  | Chunking                           | ✅        |\n| Producer  | Compression                        | ✅        |\n| Producer  | Schema                             | ✅        |\n| Producer  | Partitioned topics                 | ✅        |\n| Producer  | Access modes                       | ✅        |\n| Consumer  | ACK                                | ✅        |\n| Consumer  | Batch-index ACK                    | ✅        |\n| Consumer  | NACK                               | ✅        |\n| Consumer  | NACK back-off                      | ❌        |\n| Consumer  | Batching                           | ✅        |\n| Consumer  | Partitioned topics                 | ✅        |\n| Consumer  | Chunking                           | ✅        |\n| Consumer  | Seek                               | ✅        |\n| Consumer  | Subscription types                 | ✅        |\n| Consumer  | Subscription modes                 | ✅        |\n| Consumer  | Retry letter topic                 | ❌        |\n| Consumer  | Dead letter topic                  | ✅        |\n| Consumer  | Compression                        | ✅        |\n| Consumer  | Compaction                         | ✅        |\n| Consumer  | Schema                             | ✅        |\n| Consumer  | Configurable flow control settings | ✅        |\n| Reader    |                                    | ✅        |\n| TableView |                                    | ❌        |\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fefcasado%2Fpulsar-elixir","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fefcasado%2Fpulsar-elixir","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fefcasado%2Fpulsar-elixir/lists"}