class MessageDriver::Adapters::StompAdapter::StompContext

Public Instance Methods

handle_create_destination(name, dest_options = {}, message_props = {}) click to toggle source

def handle_subscribe(destination, consumer) destination.subscribe(&consumer) end

# File lib/message_driver/adapters/stomp_adapter.rb, line 55
def handle_create_destination(name, dest_options = {}, message_props = {})
  Destination.new(adapter, name, dest_options, message_props)
end
handle_pop_message(destination, options = {}) click to toggle source
# File lib/message_driver/adapters/stomp_adapter.rb, line 65
def handle_pop_message(destination, options = {})
  with_connection do |connection|
    sub_id = connection.uuid
    msg = nil
    count = 0
    connection.subscribe(destination.queue_path, options, sub_id)
    while msg.nil? && count < max_poll_count
      msg = connection.poll
      if msg.nil?
        count += 1
        sleep 0.1
      end
    end
    connection.unsubscribe(destination.queue_path, options, sub_id)
    Message.new(self, destination, msg) if msg
  end
end
handle_publish(destination, body, headers = {}, _properties = {}) click to toggle source
# File lib/message_driver/adapters/stomp_adapter.rb, line 59
def handle_publish(destination, body, headers = {}, _properties = {})
  with_connection do |connection|
    connection.publish(destination.queue_path, body, headers)
  end
end

Private Instance Methods

max_poll_count() click to toggle source
# File lib/message_driver/adapters/stomp_adapter.rb, line 85
def max_poll_count
  (poll_timeout / 0.1).to_i
end