Skip to content

Commit

Permalink
Use NUID based inboxes in the client
Browse files Browse the repository at this point in the history
Signed-off-by: Waldemar Quevedo <wally@synadia.com>
  • Loading branch information
wallyqs committed Jun 4, 2018
1 parent 6a703d9 commit 8ced98d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/nats/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
require "#{ep}/ext/bytesize"
require "#{ep}/ext/json"
require "#{ep}/version"
require "#{ep}/nuid"

module NATS

Expand Down Expand Up @@ -374,6 +375,7 @@ def initialize(options)
@tls = nil
@tls = options[:tls] if options[:tls]
@ssl = options[:ssl] if options[:ssl] or @tls
@nuid = NATS::NUID.new

send_connect_command
end
Expand Down Expand Up @@ -460,7 +462,7 @@ def timeout(sid, timeout, opts={}, &callback)
# @return [Object] sid
def request(subject, data=nil, opts={}, &cb)
return unless subject
inbox = NATS.create_inbox
inbox = @nuid.next
s = subscribe(inbox, opts) { |msg, reply|
case cb.arity
when 0 then cb.call
Expand Down

0 comments on commit 8ced98d

Please sign in to comment.