Class: Kafka::FetchedMessage

Inherits:
Object
  • Object
show all
Defined in:
lib/kafka/fetched_message.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message:, topic:, partition:) ⇒ FetchedMessage

Returns a new instance of FetchedMessage.



9
10
11
12
13
# File 'lib/kafka/fetched_message.rb', line 9

def initialize(message:, topic:, partition:)
  @message = message
  @topic = topic
  @partition = partition
end

Instance Attribute Details

#partitionInteger (readonly)

Returns the partition number that the message was written to.

Returns:

  • (Integer)

    the partition number that the message was written to.



7
8
9
# File 'lib/kafka/fetched_message.rb', line 7

def partition
  @partition
end

#topicString (readonly)

Returns the name of the topic that the message was written to.

Returns:

  • (String)

    the name of the topic that the message was written to.



4
5
6
# File 'lib/kafka/fetched_message.rb', line 4

def topic
  @topic
end

Instance Method Details

#create_timeTime

Returns the timestamp of the message.

Returns:

  • (Time)

    the timestamp of the message.



31
32
33
# File 'lib/kafka/fetched_message.rb', line 31

def create_time
  @message.create_time
end

#keyString

Returns the key of the message.

Returns:

  • (String)

    the key of the message.



21
22
23
# File 'lib/kafka/fetched_message.rb', line 21

def key
  @message.key
end

#offsetInteger

Returns the offset of the message in the partition.

Returns:

  • (Integer)

    the offset of the message in the partition.



26
27
28
# File 'lib/kafka/fetched_message.rb', line 26

def offset
  @message.offset
end

#valueString

Returns the value of the message.

Returns:

  • (String)

    the value of the message.



16
17
18
# File 'lib/kafka/fetched_message.rb', line 16

def value
  @message.value
end