Class: Kafka::KafkaConsumer
- Inherits:
-
Object
- Object
- Kafka::KafkaConsumer
- Defined in:
- lib/jruby-kafka/kafka-consumer.rb
Constant Summary collapse
- REQUIRED =
[ :bootstrap_servers, :key_deserializer, :value_deserializer ]
Instance Attribute Summary collapse
-
#properties ⇒ Object
readonly
Returns the value of attribute properties.
Instance Method Summary collapse
-
#initialize(config = {}) ⇒ KafkaConsumer
constructor
Create a Kafka high-level consumer.
- #stop ⇒ Object
-
#stop? ⇒ Boolean
stop? should never be overriden.
Constructor Details
#initialize(config = {}) ⇒ KafkaConsumer
Create a Kafka high-level consumer.
For other configuration properties and their default values see kafka.apache.org/documentation.html#newconsumerconfigs and kafka.apache.org/090/javadoc/org/apache/kafka/clients/consumer/ConsumerConfig.html.
26 27 28 29 30 31 |
# File 'lib/jruby-kafka/kafka-consumer.rb', line 26 def initialize(config={}) Kafka::Utility.validate_arguments REQUIRED, config @properties = config.clone @stop_called = Concurrent::AtomicBoolean.new(false) super Kafka::Utility.java_properties @properties end |
Instance Attribute Details
#properties ⇒ Object (readonly)
Returns the value of attribute properties.
33 34 35 |
# File 'lib/jruby-kafka/kafka-consumer.rb', line 33 def properties @properties end |
Instance Method Details
#stop ⇒ Object
35 36 37 38 |
# File 'lib/jruby-kafka/kafka-consumer.rb', line 35 def stop @stop_called.make_true self.wakeup end |
#stop? ⇒ Boolean
stop? should never be overriden
41 42 43 |
# File 'lib/jruby-kafka/kafka-consumer.rb', line 41 def stop? @stop_called.value end |