You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: lib/rdkafka/producer.rb
+76-35
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,6 @@
1
1
moduleRdkafka
2
2
classProducer
3
+
# @private
3
4
definitialize(native_kafka)
4
5
@closing=false
5
6
@native_kafka=native_kafka
@@ -16,13 +17,28 @@ def initialize(native_kafka)
16
17
@polling_thread.abort_on_exception=true
17
18
end
18
19
20
+
# Close this producer and wait for the internal poll queue to empty.
19
21
defclose
20
22
# Indicate to polling thread that we're closing
21
23
@closing=true
22
24
# Wait for the polling thread to finish up
23
25
@polling_thread.join
24
26
end
25
27
28
+
# Produces a message to a Kafka topic. The message is added to rdkafka's queue, call wait on the returned delivery handle to make sure it is delivered.
29
+
#
30
+
# When no partition is specified the underlying Kafka library picks a partition based on the key. If no key is specified, a random partition will be used.
31
+
# When a timestamp is provided this is used instead of the autogenerated timestamp.
32
+
#
33
+
# @param topic [String] The topic to produce to
34
+
# @param payload [String] The message's payload
35
+
# @param key [String] The message's key
36
+
# @param partition [Integer] Optional partition to produce to
37
+
# @param timestamp [Integer] Optional timestamp of this message
38
+
#
39
+
# @raise [RdkafkaError] When adding the message to rdkafka's queue failed
40
+
#
41
+
# @return [DeliveryHandle] Delivery handle that can be used to wait for the result of producing this message
0 commit comments