Class: Stenotype::Adapters::Base Abstract
- Inherits:
-
Object
- Object
- Stenotype::Adapters::Base
- Defined in:
- lib/stenotype/adapters/base.rb
Overview
This class is abstract.
An abstract base class for implementing adapters
Direct Known Subclasses
Instance Attribute Summary collapse
-
#client ⇒ Object
readonly
Returns the value of attribute client.
Instance Method Summary collapse
-
#auto_initialize! ⇒ Object
abstract
Allows custom setup of the adapter.
-
#flush! ⇒ Object
abstract
This method is expected to be implemented by subclasses.
-
#initialize(client: nil) ⇒ #publish
constructor
An adapter implementing method [#publish].
-
#publish(_event_data, **_additional_attrs) ⇒ Object
abstract
This method is expected to be implemented by subclasses.
Constructor Details
#initialize(client: nil) ⇒ #publish
Returns An adapter implementing method [#publish].
31 32 33 |
# File 'lib/stenotype/adapters/base.rb', line 31 def initialize(client: nil) @client = client end |
Instance Attribute Details
#client ⇒ Object (readonly)
Returns the value of attribute client.
26 27 28 |
# File 'lib/stenotype/adapters/base.rb', line 26 def client @client end |
Instance Method Details
#auto_initialize! ⇒ Object
This method is abstract.
Allows custom setup of the adapter. Noop by default
49 50 51 |
# File 'lib/stenotype/adapters/base.rb', line 49 def auto_initialize! # noop by default end |
#flush! ⇒ Object
This method is abstract.
This method is expected to be implemented by subclasses. In case async
publisher is used the process might end before the async queue of
messages is processed, so this method is going to be used in a
at_exit
hook to flush the queue.
61 62 63 64 |
# File 'lib/stenotype/adapters/base.rb', line 61 def flush! raise NotImplementedError, "#{self.class.name} must implement method #flush" end |
#publish(_event_data, **_additional_attrs) ⇒ Object
This method is abstract.
This method is expected to be implemented by subclasses
40 41 42 43 |
# File 'lib/stenotype/adapters/base.rb', line 40 def publish(_event_data, **_additional_attrs) raise NotImplementedError, "#{self.class.name} must implement method #publish" end |