Class: Nsqcd::Queue
- Inherits:
-
Object
- Object
- Nsqcd::Queue
- Defined in:
- lib/nsqcd/queue.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#opts ⇒ Object
readonly
Returns the value of attribute opts.
-
#topic ⇒ Object
readonly
Returns the value of attribute topic.
Instance Method Summary collapse
-
#initialize(name, opts) ⇒ Queue
constructor
A new instance of Queue.
- #publish(topic, msg) ⇒ Object
Constructor Details
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
2 3 4 |
# File 'lib/nsqcd/queue.rb', line 2 def name @name end |
#opts ⇒ Object (readonly)
Returns the value of attribute opts.
2 3 4 |
# File 'lib/nsqcd/queue.rb', line 2 def opts @opts end |
#topic ⇒ Object (readonly)
Returns the value of attribute topic.
2 3 4 |
# File 'lib/nsqcd/queue.rb', line 2 def topic @topic end |
Instance Method Details
#publish(topic, msg) ⇒ Object
10 11 12 13 |
# File 'lib/nsqcd/queue.rb', line 10 def publish(topic, msg) producer = Nsq::Producer.new(@opts[:nsqlookupd], topic) producer.write(msg) end |