Class: WaterDrop::Producer::Status
- Inherits:
-
Object
- Object
- WaterDrop::Producer::Status
- Defined in:
- lib/waterdrop/producer/status.rb
Overview
Producer lifecycle status object representation
Instance Method Summary collapse
-
#active? ⇒ Boolean
True if producer is in a active state.
-
#initialize ⇒ Status
constructor
Creates a new instance of status with the initial state.
-
#to_s ⇒ String
Current status as a string.
Constructor Details
#initialize ⇒ Status
Creates a new instance of status with the initial state
20 21 22 |
# File 'lib/waterdrop/producer/status.rb', line 20 def initialize @current = LIFECYCLE.first end |
Instance Method Details
#active? ⇒ Boolean
Returns true if producer is in a active state. Active means, that we can start sending messages. Actives states are connected (connection established) or configured, which means, that producer is configured, but connection with Kafka is not yet established.
28 29 30 |
# File 'lib/waterdrop/producer/status.rb', line 28 def active? connected? || configured? end |
#to_s ⇒ String
Returns current status as a string.
33 34 35 |
# File 'lib/waterdrop/producer/status.rb', line 33 def to_s @current.to_s end |