Class: Bunny::ConsumerTagGenerator

Inherits:
Object
  • Object
show all
Defined in:
lib/bunny/consumer_tag_generator.rb

Overview

Used to generate consumer tags in the client

Instance Method Summary collapse

Instance Method Details

#generateString

Returns Generated consumer tag.

Returns:

  • (String)

    Generated consumer tag



10
11
12
13
# File 'lib/bunny/consumer_tag_generator.rb', line 10

def generate
  t = Bunny::Timestamp.now
  "#{Kernel.rand}-#{t.to_i * 1000}-#{Kernel.rand(999_999_999_999)}"
end

#generate_prefixed(name = "bunny") ⇒ String

Unique string supposed to be used as a consumer tag.

Returns:

  • (String)

    Unique string.



20
21
22
23
# File 'lib/bunny/consumer_tag_generator.rb', line 20

def generate_prefixed(name = "bunny")
  t = Bunny::Timestamp.now
  "#{name}-#{t.to_i * 1000}-#{Kernel.rand(999_999_999_999)}"
end