class platypush.backend.kafka.KafkaBackend(server='localhost:9092', topic='platypush', **kwargs)[source]

Bases: Backend

Backend to interact with an Apache Kafka (https://kafka.apache.org/) streaming platform, send and receive messages.


  • kafka (pip install kafka-python)

__init__(server='localhost:9092', topic='platypush', **kwargs)[source]
  • server (str) – Kafka server name or address + port (default: localhost:9092)

  • topic (str) – (Prefix) topic to listen to (default: platypush). The Platypush device_id (by default the hostname) will be appended to the topic (the real topic name will e.g. be “platypush.my_rpi”)


Callback invoked when the process stops


Starts the backend thread. To be implemented in the derived classes if the loop method isn’t defined.

send_message(msg, **kwargs)[source]

Sends a platypush.message.Message to a node. To be implemented in the derived classes. By default, if the Redis backend is configured then it will try to deliver the message to other consumers through the configured Redis main queue.

  • msg – The message to send

  • queue_name – Send the message on a specific queue (default: the queue_name configured on the Redis backend)