Add AMQP URL inference mechanism
parent
0e84253825
commit
28685dcfd6
|
@ -1,10 +1,18 @@
|
||||||
# A wrapper around AMQP to stay DRY. Will make life easier if we ever need to
|
# A wrapper around AMQP to stay DRY. Will make life easier if we ever need to
|
||||||
# change protocols
|
# change protocols
|
||||||
module Transport
|
module Transport
|
||||||
|
|
||||||
|
AMQP_URL = ENV['CLOUDAMQP_URL'] ||
|
||||||
|
ENV['RABBITMQ_URL'] ||
|
||||||
|
"amqp://guest:guest@localhost:5672"
|
||||||
|
|
||||||
|
def self.connection
|
||||||
|
@connection ||= Bunny.new(AMQP_URL, read_timeout: 10, heartbeat: 10).start
|
||||||
|
end
|
||||||
|
|
||||||
def self.topic
|
def self.topic
|
||||||
@topic ||= Bunny
|
@topic ||= self
|
||||||
.new(read_timeout: 10, heartbeat: 10)
|
.connection
|
||||||
.start
|
|
||||||
.create_channel
|
.create_channel
|
||||||
.topic("amq.topic", auto_delete: true)
|
.topic("amq.topic", auto_delete: true)
|
||||||
end
|
end
|
||||||
|
|
|
@ -138,7 +138,6 @@ result.push(enum_type :LegalArgString, HASH[:args].map{ |x| x[:name] }.sort.uniq
|
||||||
result.push(enum_type :LegalKindString, HASH[:nodes].map{ |x| x[:name] }.sort.uniq)
|
result.push(enum_type :LegalKindString, HASH[:nodes].map{ |x| x[:name] }.sort.uniq)
|
||||||
result.push(enum_type :LegalSequenceKind, CeleryScriptSettingsBag::STEPS.sort)
|
result.push(enum_type :LegalSequenceKind, CeleryScriptSettingsBag::STEPS.sort)
|
||||||
result.push(enum_type :DataChangeType, CeleryScriptSettingsBag::ALLOWED_CHAGES)
|
result.push(enum_type :DataChangeType, CeleryScriptSettingsBag::ALLOWED_CHAGES)
|
||||||
result.push(enum_type :ResourceName, CeleryScriptSettingsBag::RESOURCE_NAME)
|
|
||||||
result.push(enum_type :PointType, CeleryScriptSettingsBag::ALLOWED_POINTER_TYPE)
|
result.push(enum_type :PointType, CeleryScriptSettingsBag::ALLOWED_POINTER_TYPE)
|
||||||
|
|
||||||
puts result.join.gsub("\n\n\n", "\n")
|
puts result.join.gsub("\n\n\n", "\n")
|
||||||
|
|
Loading…
Reference in New Issue