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.8.0 examples/patterns/request_reply/server.rb
amqp-1.7.0 examples/patterns/request_reply/server.rb
amqp-1.6.0 examples/patterns/request_reply/server.rb
amqp-1.5.3 examples/patterns/request_reply/server.rb
amqp-1.5.2 examples/patterns/request_reply/server.rb
amqp-1.5.1 examples/patterns/request_reply/server.rb
amqp-1.5.0 examples/patterns/request_reply/server.rb
amqp-1.4.2 examples/patterns/request_reply/server.rb
amqp-1.4.1 examples/patterns/request_reply/server.rb
amqp-1.4.0 examples/patterns/request_reply/server.rb
amqp-1.3.0 examples/patterns/request_reply/server.rb
amqp-1.2.1 examples/patterns/request_reply/server.rb
amqp-1.2.0 examples/patterns/request_reply/server.rb
amqp-1.1.8 examples/patterns/request_reply/server.rb
amqp-1.1.7 examples/patterns/request_reply/server.rb
amqp-1.1.6 examples/patterns/request_reply/server.rb
amqp-1.1.5 examples/patterns/request_reply/server.rb
amqp-1.1.4 examples/patterns/request_reply/server.rb
amqp-1.1.3 examples/patterns/request_reply/server.rb
amqp-1.0.4 examples/patterns/request_reply/server.rb