RuoteAMQP

AMQP participant and listener pair for ruote.

Documentation

See #RuoteAMQP::Listener and #RuoteAMQP::Participant for detailed documentation on using each of them.

AMQP Notes

RuoteAMQP uses durable queues and persistent messages by default, to ensure no messages get lost along the way and that running expressions doesn't have to be restarted in order for messages to be resent.

Constants

VERSION

Attributes

use_persistent_messages[W]

Public Class Methods

start!() click to toggle source

Ensure the AMQP connection is started

# File lib/ruote-amqp.rb, line 40
def start!
  return if started?

  mutex = Mutex.new
  cv = ConditionVariable.new

  Thread.main[:ruote_amqp_connection] = Thread.new do
    Thread.abort_on_exception = true
    AMQP.start {
      started!
      cv.signal
    }
  end

  mutex.synchronize { cv.wait(mutex) }

  MQ.prefetch(1)

  yield if block_given?
end
started?() click to toggle source

Check whether the AMQP connection is started

# File lib/ruote-amqp.rb, line 62
def started?
  Thread.main[:ruote_amqp_started] == true
end
stop!() click to toggle source

Close down the AMQP connections

# File lib/ruote-amqp.rb, line 71
def stop!
  return unless started?

  AMQP.stop
  Thread.main[:ruote_amqp_connection].join
  Thread.main[:ruote_amqp_started] = false
end
use_persistent_messages?() click to toggle source

Whether or not to use persistent messages (true by default)

# File lib/ruote-amqp.rb, line 34
def use_persistent_messages?
  @use_persistent_messages = true if @use_persistent_messages.nil?
  @use_persistent_messages
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.