Module: Nsqcd::Worker::ClassMethods

Defined in:
lib/nsqcd/worker.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#channelObject (readonly)

Returns the value of attribute channel.



81
82
83
# File 'lib/nsqcd/worker.rb', line 81

def channel
  @channel
end

#optsObject (readonly)

Returns the value of attribute opts.



81
82
83
# File 'lib/nsqcd/worker.rb', line 81

def opts
  @opts
end

#topicObject (readonly)

Returns the value of attribute topic.



81
82
83
# File 'lib/nsqcd/worker.rb', line 81

def topic
  @topic
end

Instance Method Details

#enqueue(msg, o = {}) ⇒ Object



87
88
89
90
# File 'lib/nsqcd/worker.rb', line 87

def enqueue(msg, o={})
  @opts[:to_queue] ||= @topic
  publisher.publish(msg, o)
end

#from(o = {}) ⇒ Object



83
84
85
# File 'lib/nsqcd/worker.rb', line 83

def from(o ={})
  @opts = o
end