Sha256: c84329cb4dcb3ec84a28e6725aaf77014e7a3d82bfa531d375da158e90548c98
Contents?: true
Size: 877 Bytes
Versions: 2
Compression:
Stored size: 877 Bytes
Contents
# simple_publisher.rb # N.B. To be used in conjunction with simple_consumer.rb # 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) # start a communication session with the amqp server b.start # create/get queue q = b.queue('po_box') # create/get exchange exch = b.exchange('sorting_room') # bind queue to exchange q.bind(exch, :key => 'fred') # 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
2 entries across 2 versions & 2 rubygems
Version | Path |
---|---|
celldee-bunny-0.1.1 | examples/simple_publisher.rb |
bunny-0.1.1 | examples/simple_publisher.rb |