class StompActors::Consumer

Attributes

subscription_id[RW]

Public Class Methods

new() click to toggle source
# File lib/stomp_actors/consumer.rb, line 12
def initialize
  async.start
end

Public Instance Methods

ack(msg) click to toggle source
# File lib/stomp_actors/consumer.rb, line 33
def ack(msg)
  client.acknowledge(msg)
end
cleanup() click to toggle source
# File lib/stomp_actors/consumer.rb, line 37
def cleanup
  unsubscribe
  disconnect
end
start() click to toggle source
# File lib/stomp_actors/consumer.rb, line 16
def start
  connect
  subscribe
end
subscribe() click to toggle source
# File lib/stomp_actors/consumer.rb, line 21
def subscribe
  me = current_actor

  client.subscribe(queue, subscribe_opts) do |msg|
    me.receive(msg)
  end
end
subscribe_opts() click to toggle source
# File lib/stomp_actors/consumer.rb, line 29
def subscribe_opts
  {}
end
unsubscribe() click to toggle source
# File lib/stomp_actors/consumer.rb, line 42
def unsubscribe
  client.unsubscribe(queue) if client && client.open?
end