Sha256: 1c39a1a395d95c3e35deea629f9c8073b1c1b1eef677d8c77a680b76cc81e5af

Contents?: true

Size: 808 Bytes

Versions: 33

Compression:

Stored size: 808 Bytes

Contents

# encoding: utf-8

$LOAD_PATH.unshift File.expand_path("../../../../lib", __FILE__)

require "amqp"

EventMachine.run do
  connection = AMQP.connect
  channel    = AMQP::Channel.new(connection)

  requests_queue = channel.queue("amqpgem.examples.services.time", :exclusive => true, :auto_delete => true)
  requests_queue.subscribe(:ack => true) do |metadata, payload|
    puts "[requests] Got a request #{metadata.message_id}. Sending a reply..."
    channel.default_exchange.publish(Time.now.to_s,
                                     :routing_key    => metadata.reply_to,
                                     :correlation_id => metadata.message_id,
                                     :mandatory      => true)

    metadata.ack
  end



  Signal.trap("INT") { connection.close { EventMachine.stop } }
end

Version data entries

33 entries across 33 versions & 1 rubygems

Version Path
amqp-1.1.2 examples/patterns/request_reply/server.rb
amqp-1.1.1 examples/patterns/request_reply/server.rb
amqp-1.1.0 examples/patterns/request_reply/server.rb
amqp-1.0.3 examples/patterns/request_reply/server.rb
amqp-1.1.0.rc1 examples/patterns/request_reply/server.rb
amqp-1.1.0.pre2 examples/patterns/request_reply/server.rb
amqp-1.1.0.pre1 examples/patterns/request_reply/server.rb
amqp-1.0.2 examples/patterns/request_reply/server.rb
amqp-1.0.1 examples/patterns/request_reply/server.rb
amqp-1.0.0 examples/patterns/request_reply/server.rb
amqp-0.9.10 examples/patterns/request_reply/server.rb
amqp-0.9.9 examples/patterns/request_reply/server.rb
amqp-0.9.8 examples/patterns/request_reply/server.rb