Skip to content

Latest commit

 

History

History
40 lines (27 loc) · 799 Bytes

File metadata and controls

40 lines (27 loc) · 799 Bytes

Lbunny

A little tiny wrapper for Lokalebasen's basic usage of Bunny.

Installation

Add this line to your application's Gemfile:

gem 'lbunny'

And then bundle

This gem is a client for RabbitMQ. To test this locally you must have a RabbitMQ broker installed. With Homebrew, do:

brew install rabbitmq

Usage

# Initialize with url to RabbitMQ
rabbit_url = "amqp://guest:guest@localhost:5672"

client = Lbunny::Client.new(rabbbit_url) { |error| puts error }

# Setup a blocking subscriber
routing_key = nil
client.subscribe("myqueuename", routing_key, { block: true }) do |delivery_info, props, payload|
  puts payload
end

# To publish messages
client.publish("Hello world", {})

For more documentation, see: Bunny Documentation