Class: Qwirk::Adapter::JMS::Publisher::MyConsumer

Inherits:
Object
  • Object
show all
Defined in:
lib/qwirk/adapter/jms/publisher.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(consumer) ⇒ MyConsumer

Returns a new instance of MyConsumer.



93
94
95
# File 'lib/qwirk/adapter/jms/publisher.rb', line 93

def initialize(consumer)
  @consumer = consumer
end

Instance Attribute Details

#worker_nameObject (readonly)

Returns the value of attribute worker_name.



91
92
93
# File 'lib/qwirk/adapter/jms/publisher.rb', line 91

def worker_name
  @worker_name
end

Instance Method Details

#timeout_read(timeout) ⇒ Object



97
98
99
100
101
102
103
104
105
106
107
108
# File 'lib/qwirk/adapter/jms/publisher.rb', line 97

def timeout_read(timeout)
  msec = (timeout * 1000).to_i
  if msec > 100
    message = @consumer.receive(msec)
  else
    #message = @consumer.receive_no_wait
    message = @consumer.receive(100)
  end
  return nil unless message
  message.acknowledge
  return [message.jms_correlation_id, Util.parse_response(message), message['qwirk:worker']]
end