Topic queues

A variation of the task queue pattern is the topic pattern. In that case, instead of having workers blindly picking every message that is added to one or several queues, they subscribe to specific topics. A topic is just a label on a message, and workers can decide to filter the messages they pick from the queue so that they match the topic.

In our microservices, this means we can have specialized workers that all register to the same messaging broker and get a subset of the messages that are added to it.

Celery is an excellent tool for building tasks queues, however, for more complex messaging, we need to use another tool:

Get Python Microservices Development now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.