dojot.module.kafka package¶
Submodules¶
dojot.module.kafka.consumer module¶
Kafka consumer module
-
class
dojot.module.kafka.consumer.
Consumer
(config, name=None)¶ Bases:
threading.Thread
Kafka consumer
-
__init__
(config, name=None)¶ Builds a new Consumer
It is important to realize that the kafka.consumer and kafka.producer configuration are directly passed to node-rdkafka library (which will forward it to librdkafka). You should check `its documentation<https://github.com/edenhill/librdkafka/blob/0.11.1.x/CONFIGURATION.md>`_ to know which are all the possible settings it offers.
Parameters:
-
run
()¶ Method representing the thread’s activity.
You may override this method in a subclass. The standard run() method invokes the callable object passed to the object’s constructor as the target argument, if any, with sequential and keyword arguments taken from the args and kwargs arguments, respectively.
-
stop
()¶ Stop this consumer
It won’t be stopped right away, be advised.
-
subscribe
(topic, callback)¶ Subscribe to a list of topics
This function will add a new topic to the topics which this consumer is subscribed to.
Parameters: - topic (str) – new topic
- callback (function) – Function to be called whenever a new message is received.
This method should not thrown any exceptions. No processing is done with its results.
-
dojot.module.kafka.producer module¶
Kafka producer
dojot.module.kafka.topic_manager module¶
Topic manager
-
class
dojot.module.kafka.topic_manager.
TopicManager
(config)¶ Bases:
object
Class that deals with DataBroker topics
-
static
get_key
(tenant, subject)¶ Return a key to be associated with a particular Kafka topic
Parameters: Return type: Returns: The key to be used
-
get_topic
(tenant, subject, global_val='')¶ Retrieves a topic from DataBroker
Parameters: Return type: Returns: The topic
-
static
Module contents¶
Kafka related modules