15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
# File 'lib/fluent/plugin/kafka_producer_ext.rb', line 15
def produce_for_buffered(value, key: nil, topic:, partition: nil, partition_key: nil)
create_time = Time.now
message = PendingMessage.new(
value: value,
key: key,
headers: EMPTY_HEADER,
topic: topic,
partition: partition,
partition_key: partition_key,
create_time: create_time
)
if @transaction_manager.transactional? && !@transaction_manager.in_transaction?
raise 'You must trigger begin_transaction before producing messages'
end
@target_topics.add(topic)
@pending_message_queue.write(message)
nil
end
|