Class: Poseidon::MessageToSend

Inherits:
Object
  • Object
show all
Defined in:
lib/poseidon/message_to_send.rb

Overview

A message we want to send to Kafka. Comprised of the topic we want to send it to, the body of the message and an optional key.

mts = Poseidon::MessageToSend.new("topic", "value", "opt_key")

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(topic, value, key = nil) ⇒ MessageToSend

Create a new message for sending to a Kafka broker.

Raises:

  • (ArgumentError)

26
27
28
29
30
31
# File 'lib/poseidon/message_to_send.rb', line 26

def initialize(topic, value, key = nil)
  raise ArgumentError, "Must provide a non-nil topic" if topic.nil?
  @topic  = topic
  @value  = value
  @key    = key
end

Instance Attribute Details

#keyObject (readonly)


10
11
12
# File 'lib/poseidon/message_to_send.rb', line 10

def key
  @key
end

#topicObject (readonly)


10
11
12
# File 'lib/poseidon/message_to_send.rb', line 10

def topic
  @topic
end

#valueObject (readonly)


10
11
12
# File 'lib/poseidon/message_to_send.rb', line 10

def value
  @value
end