Skip to content

Release v0.10.0

Compare
Choose a tag to compare
@wallyqs wallyqs released this 31 Aug 21:19
· 48 commits to master since this release
77d8a8e

Added

  • Support for drain mode (#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 (#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 (#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

  • Client now supports token based authorization

    NATS.connect(token: "deadbeef")
    
    NATS.connect(uri: "nats://deadbeef@127.0.0.1:4222")
    
    NATS.connect("nats://deadbeef@127.0.0.1:4222")

Deprecated