eigr-labs / phoenix-pubsub-nats

Elixir Phoenix.PubSub adapter based on Nats

Home Page:https://hex.pm/packages/phoenix_pubsub_nats

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Phoenix Pubsub Nats

Phoenix PubSub adapter based on Nats.

Installation

If available in Hex, the package can be installed by adding phoenix_pubsub_nats to your list of dependencies in mix.exs:

def deps do
  [
    {:phoenix_pubsub_nats, "~> 0.2.2"}
  ]
end

Usage

An example usage (add this to your supervision tree):

# 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.

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.

About

Elixir Phoenix.PubSub adapter based on Nats

https://hex.pm/packages/phoenix_pubsub_nats

License:Apache License 2.0


Languages

Language:Elixir 100.0%