Sha256: 2af1c1a6f833fe97151ca5e4799d6fa137f167f8f25d881b33dcd051831edc06

Contents?: true

Size: 581 Bytes

Versions: 2

Compression:

Stored size: 581 Bytes

Contents

require_relative "../lib/message_queue"

class Producer
  include MessageQueue::Producible

  exchange :name => "time", :type => :topic
  message :routing_key => "time.now", :mandatory => true
end

class Consumer
  include MessageQueue::Consumable

  queue :name => "print_time_now"
  exchange :name => "time", :routing_key => "time.#"

  def process(message)
    puts "Received message #{message.payload}"
  end
end

MessageQueue.connect(:adapter => :bunny, :serializer => :json)
MessageQueue.run_consumables

Producer.new.publish(Time.now.to_s)

sleep 1

MessageQueue.disconnect

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
message_queue-0.1.1 examples/producible_consumable.rb
message_queue-0.1.0 examples/producible_consumable.rb