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
22 23 24 |
# File 'lib/waterdrop/producer/status.rb', line 22 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. Active states are connected (connection established), configured which means, that producer is configured, but connection with Kafka is not yet established or disconnected, meaning it was working but user disconnected for his own reasons though sending could reconnect and continue.
31 32 33 |
# File 'lib/waterdrop/producer/status.rb', line 31 def active? connected? || configured? || disconnecting? || disconnected? end |
#to_s ⇒ String
Returns current status as a string.
36 37 38 |
# File 'lib/waterdrop/producer/status.rb', line 36 def to_s @current.to_s end |