Class: Kafka::PendingMessage

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(value:, key:, headers: {}, topic:, partition:, partition_key:, create_time:) ⇒ PendingMessage

Returns a new instance of PendingMessage.



7
8
9
10
11
12
13
14
15
16
# File 'lib/kafka/pending_message.rb', line 7

def initialize(value:, key:, headers: {}, topic:, partition:, partition_key:, create_time:)
  @value = value
  @key = key
  @headers = headers
  @topic = topic
  @partition = partition
  @partition_key = partition_key
  @create_time = create_time
  @bytesize = key.to_s.bytesize + value.to_s.bytesize
end

Instance Attribute Details

#bytesizeObject (readonly)

Returns the value of attribute bytesize.



5
6
7
# File 'lib/kafka/pending_message.rb', line 5

def bytesize
  @bytesize
end

#create_timeObject (readonly)

Returns the value of attribute create_time.



5
6
7
# File 'lib/kafka/pending_message.rb', line 5

def create_time
  @create_time
end

#headersObject (readonly)

Returns the value of attribute headers.



5
6
7
# File 'lib/kafka/pending_message.rb', line 5

def headers
  @headers
end

#keyObject (readonly)

Returns the value of attribute key.



5
6
7
# File 'lib/kafka/pending_message.rb', line 5

def key
  @key
end

#partitionObject (readonly)

Returns the value of attribute partition.



5
6
7
# File 'lib/kafka/pending_message.rb', line 5

def partition
  @partition
end

#partition_keyObject (readonly)

Returns the value of attribute partition_key.



5
6
7
# File 'lib/kafka/pending_message.rb', line 5

def partition_key
  @partition_key
end

#topicObject (readonly)

Returns the value of attribute topic.



5
6
7
# File 'lib/kafka/pending_message.rb', line 5

def topic
  @topic
end

#valueObject (readonly)

Returns the value of attribute value.



5
6
7
# File 'lib/kafka/pending_message.rb', line 5

def value
  @value
end

Instance Method Details

#==(other) ⇒ Object



18
19
20
21
22
23
24
25
26
27
# File 'lib/kafka/pending_message.rb', line 18

def ==(other)
  @value == other.value &&
    @key == other.key &&
    @topic == other.topic &&
    @headers == other.headers &&
    @partition == other.partition &&
    @partition_key == other.partition_key &&
    @create_time == other.create_time &&
    @bytesize == other.bytesize
end