Class: EventBus::Broker::Rabbit::Topic
- Inherits:
-
Object
- Object
- EventBus::Broker::Rabbit::Topic
- Defined in:
- lib/event_bus/broker/rabbit/topic.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(channel) ⇒ Topic
constructor
A new instance of Topic.
- #produce(event) ⇒ Object
- #topic ⇒ Object
Constructor Details
#initialize(channel) ⇒ Topic
Returns a new instance of Topic.
4 5 6 |
# File 'lib/event_bus/broker/rabbit/topic.rb', line 4 def initialize(channel) @channel = channel end |
Class Method Details
.produce(channel, event) ⇒ Object
16 17 18 |
# File 'lib/event_bus/broker/rabbit/topic.rb', line 16 def self.produce(channel, event) new(channel).produce(event) end |
.topic(channel) ⇒ Object
8 9 10 |
# File 'lib/event_bus/broker/rabbit/topic.rb', line 8 def self.topic(channel) new(channel).topic end |
Instance Method Details
#produce(event) ⇒ Object
20 21 22 23 |
# File 'lib/event_bus/broker/rabbit/topic.rb', line 20 def produce(event) topic.publish(event.payload, routing_key: event.name, content_type: 'application/json') end |