Sha256: e8a1682724c39cc3e44ff663d919de6a50db53b6fff9b740725b49b8cd784023

Contents?: true

Size: 870 Bytes

Versions: 20

Compression:

Stored size: 870 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,
                                     :immediate      => true,
                                     :mandatory      => true)

    metadata.ack
  end



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

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
amqp-1.0.0.pre2 examples/patterns/request_reply/server.rb
amqp-0.9.7 examples/patterns/request_reply/server.rb
amqp-0.9.6 examples/patterns/request_reply/server.rb
amqp-1.0.0.pre1 examples/patterns/request_reply/server.rb
amqp-0.9.5 examples/patterns/request_reply/server.rb
amqp-0.9.4 examples/patterns/request_reply/server.rb
amqp-0.9.3 examples/patterns/request_reply/server.rb
amqp-0.9.2 examples/patterns/request_reply/server.rb
amqp-0.9.1 examples/patterns/request_reply/server.rb
amqp-0.9.0 examples/patterns/request_reply/server.rb
amqp-0.9.0.pre3 examples/patterns/request_reply/server.rb
amqp-0.9.0.pre2 examples/patterns/request_reply/server.rb
amqp-0.9.0.pre1 examples/patterns/request_reply/server.rb
amqp-0.8.4 examples/patterns/request_reply/server.rb
amqp-0.8.3 examples/patterns/request_reply/server.rb
amqp-0.8.2 examples/patterns/request_reply/server.rb
amqp-0.8.1 examples/patterns/request_reply/server.rb
amqp-0.8.0 examples/patterns/request_reply/server.rb
amqp-0.8.0.rc15 examples/patterns/request_reply/server.rb
amqp-0.8.0.rc14 examples/patterns/request_reply/server.rb