PhoenixMicro.Transport.NATS (PhoenixMicro v1.0.0)

Copy Markdown View Source

NATS transport adapter using Gnat.

phoenix_micro lists no gnat dependency — add it to YOUR app's mix.exs:

{:gnat, "~> 1.7"}

Gnat is pure Elixir — no rebar3, no C compiler, works on all platforms.

Features

  • Core NATS pub/sub with native wildcard support (*, >).
  • Queue groups for load-balanced consumer groups.
  • Request/reply for RPC patterns.
  • Automatic reconnect with exponential backoff on connection loss.
  • Task.Supervisor-based dispatch (crashes don't kill the transport).
  • Full telemetry coverage.

Configuration

config :phoenix_micro,
  transport: :nats,
  transports: [
    nats: [
      host: "localhost",
      port: 4222,
      queue_group: "my_app",
      username: "user",    # optional
      password: "pass",    # optional
      tls: false           # optional
    ]
  ]

Summary

Functions

Returns a specification to start this module under a supervisor.

Functions

child_spec(init_arg)

@spec child_spec(keyword()) :: Supervisor.child_spec()

Returns a specification to start this module under a supervisor.

See Supervisor.

start_link(opts \\ [])

@spec start_link(keyword()) :: GenServer.on_start()