lib/kafka/producer.rb in ruby-kafka-0.4.0 vs lib/kafka/producer.rb in ruby-kafka-0.4.1
- old
+ new
@@ -183,16 +183,15 @@
# @return [nil]
def produce(value, key: nil, topic:, partition: nil, partition_key: nil)
create_time = Time.now
message = PendingMessage.new(
- value,
- key,
- topic,
- partition,
- partition_key,
+ value && value.to_s,
+ key && key.to_s,
+ topic.to_s,
+ partition && Integer(partition),
+ partition_key && partition_key.to_s,
create_time,
- key.to_s.bytesize + value.to_s.bytesize
)
if buffer_size >= @max_buffer_size
buffer_overflow topic,
"Cannot produce to #{topic}, max buffer size (#{@max_buffer_size} messages) reached"