module NATS

Overview

NATS is a pub/sub message bus.

require "nats"

# Connect to a NATS server running on localhost
nats = NATS::Client.new

# Connect to a single remote NATS server
nats = NATS::Client.new(URI.parse(ENV["NATS_URL"]))

# Connect to a NATS cluster, specified by the NATS_URLS environment variable
# as a comma-separated list of URLs
servers = ENV["NATS_URLS"]
  .split(',')
  .map { |url| URI.parse(url) }
nats = NATS::Client.new(servers: %w[
  nats://nats-1
  nats://nats-2
  nats://nats-3
])

Defined in:

error.cr
jetstream.cr
kv.cr
message.cr
nats.cr
nkeys.cr
nuid.cr
objects.cr
version.cr

Constant Summary

LOG = ::Log.for(self)
VERSION = "1.3.4"