I subscribe to Kafka using a template with a template as shown below. A wildcard is a dynamic client identifier.
consumer.subscribe(pattern='customer.*.validations')
This works well because I can snatch the client id from the subject line. But now I need to expand the functionality to listen to a similar theme for a slightly different purpose. Let me call him customer.*.additional-validations . The code should live in the same project, because so many functions are divided, but I need to be able to use a different path based on the type of the queue.
In the Kafka documentation, I see that you can subscribe to many topics. However, these are hard-coded strings. Not templates that provide flexibility.
>>>
So I'm wondering, is it possible to somehow make a combination of the two? A view like this (non-working):
consumer.subscribe(pattern=['customer.*.validations', 'customer.*.additional-validations'])
python apache-kafka kafka-python
Ben harrison
source share