class MessageQueue::Connection
Attributes
serializer[R]
settings[R]
Public Class Methods
new(serializer, settings)
click to toggle source
Public: Initialize a new Bunny connection.
serializer - The Serializer for dumping and loading payload.
settings - The Hash settings used to connect.
Returns a Connection
wrapper for Bunny.
# File lib/message_queue/connection.rb, line 16 def initialize(serializer, settings) @serializer = serializer @settings = settings end
Public Instance Methods
connect()
click to toggle source
Public: Connect to the message queue
Returns nothing
# File lib/message_queue/connection.rb, line 24 def connect logger.info("Connecting to message queue with adapter #{self.class} and settings #{settings}") end
connected?()
click to toggle source
Public: Check if it's connected to the message queue
Returns true if it's connected
# File lib/message_queue/connection.rb, line 38 def connected? false end
disconnect()
click to toggle source
Public: Disconnect from the message queue
Returns nothing
# File lib/message_queue/connection.rb, line 31 def disconnect logger.info("Disconnecting from message queue") end
new_consumer(options = {})
click to toggle source
# File lib/message_queue/connection.rb, line 58 def new_consumer(options = {}) Consumer.new(self, options) end
new_producer(options = {})
click to toggle source
# File lib/message_queue/connection.rb, line 54 def new_producer(options = {}) Producer.new(self, options) end
with_connection(&block)
click to toggle source
Public: Connect to the message, execute the block and disconnect
Returns nothing
# File lib/message_queue/connection.rb, line 45 def with_connection(&block) begin connect block.call(self) ensure disconnect end end