{"id":18000144,"url":"https://github.com/iamd3vil/nats_ex","last_synced_at":"2025-03-26T07:32:03.063Z","repository":{"id":45868341,"uuid":"63978914","full_name":"iamd3vil/nats_ex","owner":"iamd3vil","description":"Idiomatic Elixir client for Nats.io messaging system","archived":false,"fork":false,"pushed_at":"2021-12-01T18:20:09.000Z","size":47,"stargazers_count":11,"open_issues_count":2,"forks_count":3,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-17T17:50:57.672Z","etag":null,"topics":["elixir","message-queue","nats"],"latest_commit_sha":null,"homepage":null,"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/iamd3vil.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-07-22T19:41:45.000Z","updated_at":"2023-10-23T09:58:29.000Z","dependencies_parsed_at":"2022-09-05T08:10:57.642Z","dependency_job_id":null,"html_url":"https://github.com/iamd3vil/nats_ex","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iamd3vil%2Fnats_ex","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iamd3vil%2Fnats_ex/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iamd3vil%2Fnats_ex/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iamd3vil%2Fnats_ex/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/iamd3vil","download_url":"https://codeload.github.com/iamd3vil/nats_ex/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245611747,"owners_count":20643889,"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","message-queue","nats"],"created_at":"2024-10-29T23:09:51.272Z","updated_at":"2025-03-26T07:32:02.697Z","avatar_url":"https://github.com/iamd3vil.png","language":"Elixir","funding_links":[],"categories":[],"sub_categories":[],"readme":"# NatsEx [![Build Status](https://travis-ci.org/iamd3vil/nats_ex.svg?branch=master)](https://travis-ci.org/iamd3vil/nats_ex)\n\nAn idiomatic Elixir client for Nats.io messaging system\n\nCurrently PubSub functionality is implemented.\n\n## Getting started\n\nYou can start a connection with Natsd like this. See NatsEx.Connection for configuration options.\n\n```elixir\n{:ok, conn} = NatsEx.Connection.connection\n```\n\n### Subscription\n\nFor subscription to a certain topic, you can use `sub/2` or `sub/3` in `NatsEx.Connection` module. You can also give a queue group for the subscription.\n\n```elixir\n:ok = NatsEx.Connection.sub(conn, \"foo.bar\") # No queue group\n:ok = NatsEx.Connection.sub(conn, \"foo.bar\", 22) # Queue group 22\n```\n\nWhen a new message comes to a certain topic, a new message is received by all the subscribers. The message format is `{:nats_ex, :msg, subject, reply_to_subject, payload}`\n\nWhen the connection is down(closed by the server), all the subscribers receive a message `{:nats_ex, :conn_down}`\n\n### Publishing\n\nFor publishing to a certain topic, you can use `pub/3` or `pub/4` in `NatsEx.Connection` module. `reply_to` topic is optional.\n\n```elixir\n:ok = NatsEx.Connection.pub(conn, \"foo.bar\", \"This is a payload\", \"REPLY_SUBJECT\")\n```\n\n### Unsubscription\n\nYou can unsubscribe to a certain topic by using `unsub/2` or `unsub/3` in `NatsEx.Connection` module. You can also specify the number of messages, after which the subscriber will be automatically subscribed.\n\n```elixir\n:ok = NatsEx.Connection.unsub(conn, \"foo.bar\", 10) # 10 is number of messages until unsubscription. This is optional\n```\n\n## Installation\n\n`nats_ex` is available on Hex. For installing, you can do this:\n\n  1. Add `nats_ex` to your list of dependencies in `mix.exs`:\n\n    ```elixir\n    def deps do\n      [{:nats_ex, \"~\u003e 0.1\"}]\n    end\n    ```\n\n  2. Ensure `nats_ex` is started before your application:\n\n    ```elixir\n    def application do\n      [applications: [:nats_ex]]\n    end\n    ```\n\n## TODO\n\n- [x] Authorization\n- [ ] TLS\n- [x] Publish, Subscribe\n- [ ] Request, Reply\n- [ ] Nats Streaming\n\n## License\n\nMIT License. Please see LICENSE.md for more details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiamd3vil%2Fnats_ex","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fiamd3vil%2Fnats_ex","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiamd3vil%2Fnats_ex/lists"}