Module: Debci::AMQP
- Defined in:
- lib/debci/amqp.rb
Class Method Summary collapse
- .amqp_channel ⇒ Object
- .amqp_options ⇒ Object
- .conn ⇒ Object
- .get_queue(arch, backend = Debci.config.backend) ⇒ Object
- .queue_exists?(arch, backend) ⇒ Boolean
- .queue_name(arch, backend) ⇒ Object
- .results_queue ⇒ Object
Class Method Details
.amqp_channel ⇒ Object
37 38 39 |
# File 'lib/debci/amqp.rb', line 37 def self.amqp_channel @channel ||= conn.create_channel end |
.amqp_options ⇒ Object
41 42 43 44 45 46 47 48 49 |
# File 'lib/debci/amqp.rb', line 41 def self. { tls: Debci.config.amqp_ssl, tls_cert: Debci.config.amqp_cert, tls_ca_certificates: Debci.config.amqp_cacert, tls_key: Debci.config.amqp_key, verify_peer: true, } end |
.conn ⇒ Object
31 32 33 34 35 |
# File 'lib/debci/amqp.rb', line 31 def self.conn @conn ||= Bunny.new(Debci.config.amqp_server, ).tap do |c| c.start end end |
.get_queue(arch, backend = Debci.config.backend) ⇒ Object
7 8 9 10 11 12 13 14 15 16 |
# File 'lib/debci/amqp.rb', line 7 def self.get_queue(arch, backend = Debci.config.backend) opts = { durable: true, arguments: { 'x-max-priority': 10, } } q = ENV['debci_amqp_queue'] || queue_name(arch, backend) self.amqp_channel.queue(q, opts) end |
.queue_exists?(arch, backend) ⇒ Boolean
18 19 20 |
# File 'lib/debci/amqp.rb', line 18 def self.queue_exists?(arch, backend) conn.queue_exists?(queue_name(arch, backend)) end |
.queue_name(arch, backend) ⇒ Object
22 23 24 |
# File 'lib/debci/amqp.rb', line 22 def self.queue_name(arch, backend) "debci-tests-#{arch}-#{backend}" end |