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



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.

Returns:

  • (Boolean)

    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_sString

Returns current status as a string.

Returns:

  • (String)

    current status as a string



33
34
35
# File 'lib/waterdrop/producer/status.rb', line 33

def to_s
  @current.to_s
end