Class: Qwirk::Adapter::JMS::Consumer
- Inherits:
-
Object
- Object
- Qwirk::Adapter::JMS::Consumer
- Defined in:
- lib/qwirk/adapter/jms/consumer.rb
Instance Attribute Summary collapse
-
#stopped ⇒ Object
readonly
Returns the value of attribute stopped.
Instance Method Summary collapse
- #acknowledge_message ⇒ Object
-
#initialize(connection, options) ⇒ Consumer
constructor
A new instance of Consumer.
- #receive ⇒ Object
- #stop ⇒ Object
Constructor Details
#initialize(connection, options) ⇒ Consumer
Returns a new instance of Consumer.
8 9 10 11 12 13 14 |
# File 'lib/qwirk/adapter/jms/consumer.rb', line 8 def initialize(connection, ) @options = @session = connection.create_session @consumer = @session.consumer(@options) @session.start @stopped = false end |
Instance Attribute Details
#stopped ⇒ Object (readonly)
Returns the value of attribute stopped.
6 7 8 |
# File 'lib/qwirk/adapter/jms/consumer.rb', line 6 def stopped @stopped end |
Instance Method Details
#acknowledge_message ⇒ Object
22 23 24 |
# File 'lib/qwirk/adapter/jms/consumer.rb', line 22 def @message.acknowledge end |
#receive ⇒ Object
16 17 18 19 20 |
# File 'lib/qwirk/adapter/jms/consumer.rb', line 16 def receive @message = @consumer.receive return nil unless @message return Util.parse_response(@message) end |
#stop ⇒ Object
26 27 28 29 30 31 32 33 |
# File 'lib/qwirk/adapter/jms/consumer.rb', line 26 def stop return if @stopped Qwirk.logger.info "Stopping consumer for #{@options.inspect}" # Don't clobber the session before a reply @consumer.close if @consumer @session.close if @session @stopped = true end |