Nats.rb Versions Save

Ruby client for NATS, the cloud native messaging system.

v0.11.0

4 years ago

Release with support for NATS v2 auth features

Added

  • Support for user credentials that contain a JWT/NKEY to auth against NATS v2 servers
require 'nats/client'

NATS.start("tls://connect.ngs.global", user_credentials: "/path/to/creds") do |nc|
  nc.subscribe("hello") do |msg|
    puts "[Received] #{msg}"
  end
  nc.publish('hello', 'world')
end
  • Support to authenticate against NATS v2 servers that use NKEYS
require 'nats/client'

NATS.start("tls://connect.ngs.global", nkeys_seed: "path/to/seed.txt") do |nc|
  nc.subscribe("hello") do |msg|
    puts "[Received] #{msg}"
  end
  nc.publish('hello', 'world')
end
  • Added --creds option to nats-pub, nats-sub, nats-queue tools

Changed

  • Internal changes to process initial INFO message from the server

Fixed

  • Fixed being able to use 'tls' as the scheme when connecting with a single URL

    NATS.connect("tls://demo.nats.io:4443")
    

v0.10.0

5 years ago

Added

  • Support for drain mode (https://github.com/nats-io/ruby-nats/pull/157)

    This feature allows clients to gracefully disconect, letting the subscribers handle any inflight messages that may have been sent by the server already.

    NATS.start(drain_timeout: 1) do |nc|
      NATS.subscribe('foo', queue: "workers") do |msg, reply, sub|
        nc.publish(reply, "ACK:#{msg}")
      end
    
      NATS.subscribe('bar', queue: "workers") do |msg, reply, sub|
        nc.publish(reply, "ACK:#{msg}")
      end
    
      NATS.subscribe('quux', queue: "workers") do |msg, reply, sub|
        nc.publish(reply, "ACK:#{msg}")
      end
    
      EM.add_timer(2) do
        next if NATS.draining?
    
        # Drain gracefully closes the connection.
        NATS.drain do
          puts "Done draining. Connection is closed."
        end
      end
    end
    
  • Support for no_echo mode (https://github.com/nats-io/ruby-nats/pull/155)

    When connected to a NATS Server v1.2.0 or above, a client can now opt to avoid receiving messages that it itself has published.

    NATS.connect(no_echo: true)
    

Improved

  • NATS.connect API is now more similar to how it works in the Go client (https://github.com/nats-io/ruby-nats/pull/156):

    # Assume 'nats://' scheme
    NATS.connect("demo.nats.io:4222")
    
    # Complete with scheme a la Go client classic usage.
    NATS.connect("nats://demo.nats.io:4222")
    
    # Use default 4222 port.
    NATS.connect("demo.nats.io")
    
    # Explicit cluster list still supported
    NATS.connect(servers: ["nats://demo.nats.io:4222"])
    

Fixed

Deprecated

v0.9.2

5 years ago

Minor version release including fixes to support multiple CAs when using secure connections.

Fixed

TLS Peer verification: ssl_verify_peer does not support multiple CAs

https://github.com/nats-io/ruby-nats/issues/151 Thanks to @h4xnoodle @pivotal-jamil-shamy for the contribution.

v0.9.0

5 years ago

Added

Changed

v0.8.4

6 years ago

Added

Fixed

Removed

v0.8.2

7 years ago
  • Allow setting name from client on connect (#129)
  • Add discovered servers helper for servers announced via async INFO (#136)
  • Add time based reconnect backoff (#139)
  • Modify lang sent on connect when using jruby (#135)
  • Update eventmachine dependencies (#134)

v0.8.0

7 years ago
  • Added cluster auto discovery handling which is supported on v0.9.2 server release (#125)
  • Added jruby part of the build (both in openjdk and oraclejdk runtimes) (#122 #123)
  • Fixed ping interval accounting (#120)

v0.7.1

7 years ago

Minor release which changes nats client dependencies so that only Eventmachine > 1.2 is required

v0.7.0

7 years ago
  • Eventmachine bumped to 1.2 series
  • Upgraded TLS support, certs and verify peer functionality