Module: K8::Lib
- Defined in:
- lib/k8/lib.rb,
lib/k8/lib/version.rb
Defined Under Namespace
Classes: Error
Constant Summary collapse
- VERSION =
"1.0.1"
Class Attribute Summary collapse
-
.buffer_size ⇒ Object
Returns the value of attribute buffer_size.
-
.partition_key ⇒ Object
Returns the value of attribute partition_key.
-
.topic_name ⇒ Object
Returns the value of attribute topic_name.
Class Method Summary collapse
Class Attribute Details
.buffer_size ⇒ Object
Returns the value of attribute buffer_size.
19 20 21 |
# File 'lib/k8/lib.rb', line 19 def buffer_size @buffer_size end |
.partition_key ⇒ Object
Returns the value of attribute partition_key.
19 20 21 |
# File 'lib/k8/lib.rb', line 19 def partition_key @partition_key end |
.topic_name ⇒ Object
Returns the value of attribute topic_name.
19 20 21 |
# File 'lib/k8/lib.rb', line 19 def topic_name @topic_name end |
Class Method Details
.config {|_self| ... } ⇒ Object
20 21 22 |
# File 'lib/k8/lib.rb', line 20 def config yield self end |
.produce(message, t, partition_key = '') ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/k8/lib.rb', line 25 def produce(, t, partition_key = '') # This will queue the two messages in the internal buffer. # DeliveryBoy.produce(comment.to_json, topic: "comments") if partition_key.nil? || partition_key.empty? DeliveryBoy.produce(.to_json, topic: (t || topic_name)) else DeliveryBoy.produce(.to_json, topic: (t || topic_name), partition_key: partition_key) end # This will deliver all messages in the buffer to Kafka. # This call is blocking. if DeliveryBoy.buffer_size >= buffer_size DeliveryBoy. end return 'done' end |