Sha256: c60fcf0f69e233f97bad8fc5ed77984ea4b2d06aaf29338a73b1605ad3d4becc
Contents?: true
Size: 785 Bytes
Versions: 1
Compression:
Stored size: 785 Bytes
Contents
require 'amqp' module Travis module Amqp class << self def setup_connection require 'amqp/utilities/event_loop_helper' AMQP::Utilities::EventLoopHelper.run AMQP.start(Travis.config.amqp) do |connection| Rails.logger.info 'Connected to AMQP broker' AMQP.channel = AMQP::Channel.new(connection) end end def publish(queue, payload) body = MultiJson.encode(payload) metadata = { :routing_key => queue, :persistent => true, :durable => true, :auto_delete => false } exchange.publish(body, metadata) end protected def exchange @exchange ||= AMQP.channel.default_exchange end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
travis-core-0.0.1 | lib/travis/amqp.rb |