Class: WaterDrop::Producer::Status

Inherits:
Object
  • Object
show all
Defined in:
lib/waterdrop/producer/status.rb

Overview

Producer lifecycle status object representation

Instance Method Summary collapse

Constructor Details

#initializeStatus

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.

Returns:

  • (Boolean)

    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_sString

Returns current status as a string.

Returns:

  • (String)

    current status as a string



36
37
38
# File 'lib/waterdrop/producer/status.rb', line 36

def to_s
  @current.to_s
end