Sha256: 48f5586a34acc32b92ba07514869a729bc71195b4f99e5cfab817b83df36a520

Contents?: true

Size: 1.66 KB

Versions: 2

Compression:

Stored size: 1.66 KB

Contents

RabbitMQ JRuby Client
=====================
rabbitmq-jruby-client allows you to use RabbitMQ Client from JRuby using the official Java RabbitMQ client from Rabbit Technologies
See more at http://www.rabbitmq.com

Getting Started
===============
1. Make sure you can install RubyGem from GitHub (you only have to do this once): jruby -S gem sources -a http://gems.github.com
2. Install and start RabbitMQ (see below)
3. Install JRuby RabbitMQ Client: jruby -S gem install jerryluk-rabbitmq-jruby-client

Example Usage
=============
gem 'jerryluk-rabbitmq-jruby-client'
require 'rabbitmq_client'

# Initializes the new client and connect to the server
client = RabbitMQClient.new

# Initializes a new queue
queue = client.queue('queue_name')

# Initializes a new exchange
exchange = client.exchange('exchange_name')

# Connects queue with the exchange
queue.bind(exchange)

# Publish a message to the queue
queue.publish('message body')

# Retrieve a message from the queue
message = queue.retrieve

# Subscribe to a queue with callback. The callback will be run in a new thread for each new message. 
queue.subscribe do |message|
  # do something with message
end

# Subscribe to a queue in a loop. No new thread will be created.
queue.loop_subscribe do |message|
  # do something with message
end


Installing RabbitMQ on OS X
===========================
1. Install MacPorts
2. sudo port install erlang
3. wget http://www.rabbitmq.com/releases/rabbitmq-server/v1.5.3/rabbitmq-server-generic-unix-1.5.3.tar.gz
4. tar zxvf rabbitmq-server-1.5.3.tar.gz
5. sudo mv rabbitmq_server-1.5.3 /opt/local/lib/erlang/lib

To run RabbitMQ
6. sudo /opt/local/lib/erlang/lib/rabbitmq_server-1.5.3/sbin/rabbitmq-server

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
jerryluk-rabbitmq-jruby-client-0.1.7 README
rabbitmq-jruby-client-0.1.7 README