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.



11
12
13
14
15
# File 'lib/kafka/fetched_message.rb', line 11

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

Instance Attribute Details

#partition ⇒ Integer (readonly)

Returns the partition number that the message was written to.

Returns:

  • (Integer) —

    the partition number that the message was written to.



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

def partition
  @partition
end

#topic ⇒ String (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.



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

def topic
  @topic
end

Instance Method Details

#create_time ⇒ Time

Returns the timestamp of the message.

Returns:

  • (Time) —

    the timestamp of the message.



33
34
35
# File 'lib/kafka/fetched_message.rb', line 33

def create_time
  @message.create_time
end

#headers ⇒ Hash<String, String>

Returns the headers of the message.

Returns:

  • (Hash<String, String>) —

    the headers of the message.



38
39
40
# File 'lib/kafka/fetched_message.rb', line 38

def headers
  @message.headers
end

#is_control_record ⇒ Boolean

Returns whether this record is a control record.

Returns:

  • (Boolean) —

    whether this record is a control record



43
44
45
# File 'lib/kafka/fetched_message.rb', line 43

def is_control_record
  @message.is_control_record
end

#key ⇒ String

Returns the key of the message.

Returns:

  • (String) —

    the key of the message.



23
24
25
# File 'lib/kafka/fetched_message.rb', line 23

def key
  @message.key
end

#offset ⇒ Integer

Returns the offset of the message in the partition.

Returns:

  • (Integer) —

    the offset of the message in the partition.



28
29
30
# File 'lib/kafka/fetched_message.rb', line 28

def offset
  @message.offset
end

#value ⇒ String

Returns the value of the message.

Returns:

  • (String) —

    the value of the message.



18
19
20
# File 'lib/kafka/fetched_message.rb', line 18

def value
  @message.value
end