Chris Duncan celldee

View gist:4550692
1 2 3 4 5 6 7 8 9
If you want to connect to your rabbit node via the Erlang REPL then you can start another node in the REPL like this -
 
erl -sname test -setcookie "ERLANGCOOKIE"
 
then try -
 
net_adm:ping('rabbit@hostname').
 
If it returns 'pong' then you're in business, but if you see 'pang' returned then you have not managed to reach your rabbit node.
View gist:4512337
1 2 3 4 5 6 7 8 9
require 'bunny'
 
conn = Bunny.new
conn.start
 
ch = conn.create_channel
 
x = ch.direct('hello-exchange', :durable => true)
q = ch.queue('hello-queue', :durable => true).bind(x, :routing_key => 'hola')
View gist:4500579
1 2 3 4 5 6 7 8 9 10
Publisher
---------
 
require 'bunny'
 
conn = Bunny.new
conn.start
 
ch = conn.channel
ch.confirm_select
View gist:4253043
1
conn = Bunny.new(:keepalive => true)
View gist:4253037
1 2 3 4 5 6 7 8 9
conn = Bunny.new(:heartbeat => 30)
 
# or
 
conn = Bunny.new(:heartbeat_interval => 30)
 
# or
 
conn = Bunny.new(:requested_heartbeat => 30)
View gist:4247233
1
q = b.queue('testq', :arguments => {"x-message-ttl" => 60000}) # messages are deemed dead after 60 secs
View gist:4247204
1
q.publish('test message', :expiration => "60000") # message will reside in queue maximum 1 minute
View gist:4247130
1
q = b.queue('testq', :arguments => {"x-expires" => 120000}) # idle queue expires after 2 mins
View gist:4241084
1 2 3 4 5 6 7 8 9 10
# /etc/rabbitmq/rabbitmq.config
#
# Follow the instructions on RabbitMQ website to create certificate authority and certificates -
#
# http://www.rabbitmq.com/ssl.html
#
 
[
{rabbit, [
{tcp_listeners,[{"127.0.0.1",5672}]},
View bunny_connect.rb
1 2 3 4 5 6 7 8 9 10
require 'bunny'
 
# Usual arguments
conn = Bunny.new(:host => 'myhost', :ssl => true)
conn.start
puts conn.status # :open
puts conn.ssl? # true
 
# URI
conn2 = Bunny.new("amqps://myhost/%2F") # %2F is '/' URL encoded
Something went wrong with that request. Please try again.