Consider a Django app configured to use Redis as a message broker. When the app publishes a message to a Redis channel, what is the expected behavior?
Think about how Redis Pub/Sub works with subscribers.
Redis Pub/Sub delivers messages instantly to all connected subscribers of the channel. If no subscriber is connected, the message is not stored or queued.
Which of the following code snippets correctly publishes a message to a Redis channel named 'notifications' using the redis-py client in Django?
Check the redis-py documentation for the method to send messages to a channel.
The correct method to publish a message to a Redis channel using redis-py is publish. Other methods do not exist or serve different purposes.
A Django app subscribes to a Redis channel but never receives messages published to that channel. Which of the following is the most likely cause?
Check the subscriber setup steps carefully.
If the subscriber does not call subscribe on the Redis client, it will not receive any messages from the channel.
If a Django app publishes messages to a Redis channel but no clients are subscribed at that moment, what happens to those messages in Redis?
Think about Redis Pub/Sub message persistence.
Redis Pub/Sub does not store messages if no subscribers are connected. Messages are discarded immediately.
Which of the following reasons best explains why a developer might choose Redis as a message broker for a Django app?
Consider Redis strengths and limitations compared to other brokers.
Redis is known for fast in-memory operations and simple Pub/Sub, making it suitable for lightweight messaging and task queues. It does not guarantee persistence or complex routing like RabbitMQ.