Class: Warren::Broadcast::Channel

Inherits:
Object
  • Object
show all
Defined in:
lib/warren/broadcast.rb

Instance Method Summary collapse

Constructor Details

#initialize(bun_channel, exchange: nil) ⇒ Channel


7
8
9
10
# File 'lib/warren/broadcast.rb', line 7

def initialize(bun_channel, exchange: nil)
  @bun_channel = bun_channel
  @exchange_name = exchange
end

Instance Method Details

#<<(message) ⇒ Object


12
13
14
15
# File 'lib/warren/broadcast.rb', line 12

def <<(message)
  exchange.publish(message.payload, routing_key: message.routing_key)
  self
end

#closeObject


17
18
19
# File 'lib/warren/broadcast.rb', line 17

def close
  @bun_channel.close
end