Method: NATS.drain
- Defined in:
- lib/nats/client.rb
.drain(&blk) ⇒ Object
Drain gracefully disconnects from the server, letting subscribers process pending messages already sent by server and optionally calls the associated block.
269 270 271 272 273 |
# File 'lib/nats/client.rb', line 269 def drain(&blk) if (client and !client.draining? and (client.connected? || client.reconnecting?)) client.drain { blk.call if blk } end end |