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