Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RdKafkaConsumer subscribes to queue name instead of topic name #98

Open
floplus opened this issue Mar 23, 2020 · 2 comments
Open

RdKafkaConsumer subscribes to queue name instead of topic name #98

floplus opened this issue Mar 23, 2020 · 2 comments

Comments

@floplus
Copy link

floplus commented Mar 23, 2020

I found something i THINK is wrong. As I am pretty new to enqueue and kafka i don't know if it is really a bug, but it bugges/d me. :)

I tried to connect two symfony applications via kafka and didn't get it working until i followed how the consumer is build.

In QueueInteropTransport.php->getConsumer() the $queue is build from the $destination which has topic and queue set either from default options or from Envelope.

In RdKafkaContext the queue is build by passing the queue name to RdKafkaTopic.
Then in createConsumer a new RdKafkaConsumer is created by passing the Destination (which is the Queue wihich is the RdKafkaTopic) as third parameter (which is a RdKafkaTopic).

The RdKafkaConsumer then subscribes (line 90) to the Queue name.

Shouldn't it be the topic name?

Now essentially queue and topic name MUST be identical to make the consumer consume messages from a queue and topic.

@Steveb-p
Copy link

Steveb-p commented Mar 23, 2020

True, but you can't really create consumers on the fly when running messenger:consume. Subscribed topic has to come from configuration.
The ability to set a target Kafka topic is, in practice, only to allow passing message to a different topic / bus / application.

Theoretically regex can be used to subscribe to multiple kafka topics at once, but it's not really used frequently.

@floplus
Copy link
Author

floplus commented Mar 23, 2020

@Steveb-p i think i didn't make my concern clear. I know that with messenger:consume only the default values from configuration can be taken, but the topic the consumer subscribes to is the queue name not the topic name.
But you can configure topic and queue separately (which you effectly can't because of the current implementation).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants