platypush.backend.redis

class platypush.backend.redis.RedisBackend(queue='platypush_bus_mq', redis_args=None, *args, **kwargs)[source]

Backend that reads messages from a configured Redis queue (default: platypush_bus_mq) and posts them to the application bus. Very useful when you have plugin whose code is executed in another process and can’t post events or requests to the application bus.

Requires:

  • redis (pip install redis)
__init__(queue='platypush_bus_mq', redis_args=None, *args, **kwargs)[source]
Parameters:
run()[source]

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

send_message(msg, queue_name=None, **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.

Parameters:
  • msg – The message to send
  • queue_name – Send the message on a specific queue (default: the queue_name configured on the Redis backend)