Class: EventBus::Emitter
- Inherits:
-
Object
- Object
- EventBus::Emitter
- Defined in:
- lib/event_bus/emitter.rb
Overview
Public: An class which decorates el-rabbit topic creation.
Class Method Summary collapse
-
.trigger(*events) ⇒ Object
Public: Produces a event on the Broker.
Class Method Details
.trigger(*events) ⇒ Object
Public: Produces a event on the Broker.
event - The event to be produced.
Returns the Event.
12 13 14 15 16 17 18 19 20 21 |
# File 'lib/event_bus/emitter.rb', line 12 def self.trigger(*events) events.flatten.each_with_index do |event, index| raise MissingAttributeError.new("Event on position #{index} must have a body") unless event.has_body? raise MissingAttributeError.new("Event on position #{index} must have a name") unless event.has_name? end EventBus::Config.broker.produce(events.flatten) events end |