rabbitmq-tutorials/ruby
2012-07-18 18:30:26 +03:00
..
emit_log_direct.rb Ruby: new_task.rb, ARGV fix. 2011-05-03 04:14:32 +02:00
emit_log_topic.rb Ruby: new_task.rb, ARGV fix. 2011-05-03 04:14:32 +02:00
emit_log.rb Ruby: new_task.rb, ARGV fix. 2011-05-03 04:14:32 +02:00
new_task.rb Ruby: new_task.rb, ARGV fix. 2011-05-03 04:14:32 +02:00
README.md Recommend Windows users to go with JRuby 2011-05-24 10:23:37 +04:00
receive_logs_direct.rb Ruby: receive_logs.rb, receive_logs_direct.rb and receive_logs_topic.rb. 2011-05-03 04:48:37 +02:00
receive_logs_topic.rb Ruby: receive_logs.rb, receive_logs_direct.rb and receive_logs_topic.rb. 2011-05-03 04:48:37 +02:00
receive_logs.rb Ruby: receive_logs.rb, receive_logs_direct.rb and receive_logs_topic.rb. 2011-05-03 04:48:37 +02:00
receive.rb Ruby: receive.rb 2011-05-03 04:30:15 +02:00
rpc_client.rb Message always publish to localhost. Reuse base 'channel' method to publish and subscribe on one instance (via change connection host to not localhost). 2012-07-18 18:30:26 +03:00
rpc_server.rb Proper SIGINT handling from ruby rpc_server 2011-07-07 17:01:28 +01:00
send.rb Prefer AMQP::Channel#default_exchange 2011-05-18 13:10:23 +04:00
worker.rb Whops, I forgot {:ack => true}. 2011-05-18 11:16:30 +02:00

Ruby code for RabbitMQ tutorials

Here you can find Ruby code examples from RabbitMQ tutorials.

Requirements

If you use Microsoft Windows, we highly recommend you to use JRuby. It is 1.9.2-compatible since 1.6.0.

To run this code you need amqp gem version 0.8 (currently available as a prerelease version). This code won't work with earlier versions!

You can install it via RubyGems. On Linux, Mac OS X and *BSD systems:

gem install amqp --pre --version "~> 0.8.0.rc12"

On Windows:

jruby.exe --1.9 -S gem install amqp --pre --version "~> 0.8.0.rc12"

Code

Tutorial one: "Hello World!":

ruby send.rb
ruby receive.rb

Tutorial two: Work Queues:

ruby new_task.rb
ruby worker.rb

Tutorial three: Publish/Subscribe

ruby receive_logs.rb
ruby emit_log.rb

Tutorial four: Routing

ruby receive_logs_direct.rb
ruby emit_log_direct.rb

Tutorial five: Topics

ruby receive_logs_topic.rb
ruby emit_log_topic.rb

Tutorial six: RPC

ruby rpc_server.rb
ruby rpc_client.rb

To learn more, visit Ruby AMQP gem documentation site.