Class: Hermann::Discovery::Metadata::Partition

Inherits:
Struct
  • Object
show all
Defined in:
lib/hermann/discovery/metadata.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#idObject

Returns the value of attribute id

Returns:

  • (Object)

    the current value of id



14
15
16
# File 'lib/hermann/discovery/metadata.rb', line 14

def id
  @id
end

#insync_replicasObject

Returns the value of attribute insync_replicas

Returns:

  • (Object)

    the current value of insync_replicas



14
15
16
# File 'lib/hermann/discovery/metadata.rb', line 14

def insync_replicas
  @insync_replicas
end

#leaderObject

Returns the value of attribute leader

Returns:

  • (Object)

    the current value of leader



14
15
16
# File 'lib/hermann/discovery/metadata.rb', line 14

def leader
  @leader
end

#replicasObject

Returns the value of attribute replicas

Returns:

  • (Object)

    the current value of replicas



14
15
16
# File 'lib/hermann/discovery/metadata.rb', line 14

def replicas
  @replicas
end

#topic_nameObject

Returns the value of attribute topic_name

Returns:

  • (Object)

    the current value of topic_name



14
15
16
# File 'lib/hermann/discovery/metadata.rb', line 14

def topic_name
  @topic_name
end

Instance Method Details

#consumer(offset = :end) ⇒ Object



15
16
17
# File 'lib/hermann/discovery/metadata.rb', line 15

def consumer(offset=:end)
  Hermann::Consumer.new(topic_name, brokers: ([leader] + replicas).join(','), partition: id, offset: offset)
end