https://github.com/eigr-labs/phoenix-pubsub-nats
Elixir Phoenix.PubSub adapter based on Nats
https://github.com/eigr-labs/phoenix-pubsub-nats
nats-client nats-messaging phoenix-elixir
Last synced: 4 months ago
JSON representation
Elixir Phoenix.PubSub adapter based on Nats
- Host: GitHub
- URL: https://github.com/eigr-labs/phoenix-pubsub-nats
- Owner: eigr-labs
- License: apache-2.0
- Created: 2022-11-14T20:16:46.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2026-02-02T20:47:35.000Z (5 months ago)
- Last Synced: 2026-02-22T15:39:57.929Z (4 months ago)
- Topics: nats-client, nats-messaging, phoenix-elixir
- Language: Elixir
- Homepage: https://hex.pm/packages/phoenix_pubsub_nats
- Size: 157 KB
- Stars: 10
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Phoenix Pubsub Nats
Phoenix PubSub adapter based on Nats.
## Installation
If [available in Hex](https://hex.pm/docs/publish), the package can be installed
by adding `phoenix_pubsub_nats` to your list of dependencies in `mix.exs`:
```elixir
def deps do
[
{:phoenix_pubsub_nats, "~> 0.2.2"}
]
end
```
## Usage
An example usage (add this to your supervision tree):
```elixir
# application.ex
children = [
{
Phoenix.PubSub,
name: Phoenix.PubSubTest,
adapter: PhoenixPubsubNats,
connection: %{host: '127.0.0.1', port: 4222}
}
]
```
where `connection` is configured separately based on the `gnat`
[documentation](https://hexdocs.pm/gnat/readme.html).
Optional parameters:
* `serializer`: Used to convert messages to/from the underlying Nats system.
This library provides two implementations of the `Nats.Serializer`
serialization module, namely:
* `Nats.Serializer.Native`: Convert messages using Erlang's native serialization mechanism.
* `Nats.Serializer.Json`: Convert messages using Json format.
For more details on how to use it, see the [Phoenix.PubSub documentation](https://hexdocs.pm/phoenix_pubsub/Phoenix.PubSub.html).