Class: Synapse::EventBus::EventBus Abstract

Inherits:
Object
  • Object
show all
Defined in:
lib/synapse/event_bus/event_bus.rb

Overview

This class is abstract.

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.

Direct Known Subclasses

SimpleEventBus

Instance Method Summary collapse

Instance Method Details

#publish(*events) ⇒ undefined

This method is abstract.

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.

Parameters:

  • events (EventMessage...)

Returns:

  • (undefined)

Raises:

  • (NotImplementedError)


18
19
20
# File 'lib/synapse/event_bus/event_bus.rb', line 18

def publish(*events)
  raise NotImplementedError
end

#subscribe(listener) ⇒ undefined

This method is abstract.

Subscribes the given listener to this event bus

Parameters:

Returns:

  • (undefined)

Raises:



28
29
30
# File 'lib/synapse/event_bus/event_bus.rb', line 28

def subscribe(listener)
  raise NotImplementedError
end

#unsubscribe(listener) ⇒ undefined

This method is abstract.

Unsubscribes the given listener from this event bus

Parameters:

Returns:

  • (undefined)

Raises:

  • (NotImplementedError)


37
38
39
# File 'lib/synapse/event_bus/event_bus.rb', line 37

def unsubscribe(listener)
  raise NotImplementedError
end