class Synapse::EventBus::EventBus

Represents a mechanism for event listeners to subscribe to events and for event publishers to dispatch their events to any interested parties.

Implementations may or may not dispatch the events to listeners in the dispatching thread.

@abstract

Public Instance Methods

publish(*events) click to toggle source

Publishes one or more events to any listeners subscribed to this event bus

Implementations may treat the given events as a single batch and distribute them as such to all subscribed event listeners.

@abstract @param [EventMessage…] events @return [undefined]

# File lib/synapse/event_bus/event_bus.rb, line 18
def publish(*events)
  raise NotImplementedError
end
subscribe(listener) click to toggle source

Subscribes the given listener to this event bus

@abstract @raise [SubscriptionError] If subscription of an event listener failed @param [EventListener] listener @return [undefined]

# File lib/synapse/event_bus/event_bus.rb, line 28
def subscribe(listener)
  raise NotImplementedError
end
unsubscribe(listener) click to toggle source

Unsubscribes the given listener from this event bus

@abstract @param [EventListener] listener @return [undefined]

# File lib/synapse/event_bus/event_bus.rb, line 37
def unsubscribe(listener)
  raise NotImplementedError
end