Class: Bunnicula::Relay
- Extended by:
- DslBase
- Defined in:
- lib/bunnicula/relay.rb
Instance Attribute Summary collapse
-
#source_exchange ⇒ Object
readonly
Returns the value of attribute source_exchange.
-
#target_exchange ⇒ Object
readonly
Returns the value of attribute target_exchange.
Instance Method Summary collapse
- #from(*args) ⇒ Object
-
#queue_name ⇒ Object
Operational.
- #start(amq, bunny) ⇒ Object
- #to(*args) ⇒ Object
Methods included from DslBase
Instance Attribute Details
#source_exchange ⇒ Object (readonly)
Returns the value of attribute source_exchange.
5 6 7 |
# File 'lib/bunnicula/relay.rb', line 5 def source_exchange @source_exchange end |
#target_exchange ⇒ Object (readonly)
Returns the value of attribute target_exchange.
5 6 7 |
# File 'lib/bunnicula/relay.rb', line 5 def target_exchange @target_exchange end |
Instance Method Details
#from(*args) ⇒ Object
7 8 9 10 11 12 |
# File 'lib/bunnicula/relay.rb', line 7 def from(*args) return @source_exchange if args.length == 0 = args. exchange_name = args.pop @source_exchange = Bunnicula::Exchange.new(exchange_name,) end |
#queue_name ⇒ Object
Operational
22 23 24 |
# File 'lib/bunnicula/relay.rb', line 22 def queue_name "bunnicula.#{from.name}" end |
#start(amq, bunny) ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/bunnicula/relay.rb', line 26 def start(amq,bunny) DaemonKit.logger.info "Starting relay from:#{from.name} to:#{to.name || from.name}" @channel = amq @bunny = bunny prepare_destination_exchange bind_to_source_exchange subscribe_to_queue DaemonKit.logger.info "Relay started" end |