Sha256: 90a87db4545d7aab065b43dd861e46035db288f31d7eddf9065301e59a9c3154

Contents?: true

Size: 836 Bytes

Versions: 17

Compression:

Stored size: 836 Bytes

Contents

# simple_publisher.rb

# N.B. To be used in conjunction with simple_consumer.rb. See simple_consumer.rb for explanation.

# Assumes that target message broker/server has a user called 'guest' with a password 'guest'
# and that it is running on 'localhost'.

# If this is not the case, please change the 'Bunny.new' call below to include
# the relevant arguments e.g. b = Bunny.new(:user => 'john', :pass => 'doe', :host => 'foobar')

$:.unshift File.dirname(__FILE__) + '/../lib'

require 'bunny'

b = Bunny.new(:logging => true, :spec => '09')

# start a communication session with the amqp server
b.start

# create/get exchange
exch = b.exchange('sorting_room')

# publish message to exchange
exch.publish('This is a message from the publisher', :key => 'fred')

# message should now be picked up by the consumer so we can stop
b.stop

Version data entries

17 entries across 17 versions & 3 rubygems

Version Path
celldee-bunny-0.5.0 examples/simple_publisher_09.rb
celldee-bunny-0.5.1 examples/simple_publisher_09.rb
celldee-bunny-0.5.2 examples/simple_publisher_09.rb
celldee-bunny-0.5.3 examples/simple_publisher_09.rb
sidekick-client-0.2.5 lib/ext/bunny-0.6.0/examples/simple_publisher_09.rb
bunny-0.6.3.rc2 examples/simple_publisher_09.rb
bunny-0.6.3.rc1 examples/simple_publisher_09.rb
sidekick-client-0.2.4 lib/ext/bunny-0.6.0/examples/simple_publisher_09.rb
sidekick-client-0.2.3 lib/ext/bunny-0.6.0/examples/simple_publisher_09.rb
sidekick-client-0.2.2 lib/ext/bunny-0.6.0/examples/simple_publisher_09.rb
sidekick-client-0.2.1 lib/ext/bunny-0.6.0/examples/simple_publisher_09.rb
sidekick-client-0.2.0 lib/ext/bunny-0.6.0/examples/simple_publisher_09.rb
sidekick-client-0.1.0 lib/ext/bunny-0.6.0/examples/simple_publisher_09.rb
bunny-0.6.0 examples/simple_publisher_09.rb
bunny-0.5.3 examples/simple_publisher_09.rb
bunny-0.5.2 examples/simple_publisher_09.rb
bunny-0.5.1 examples/simple_publisher_09.rb