strimzi / strimzi-kafka-bridge

An HTTP bridge for Apache Kafka®

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Subscribe and assign with empty topics/partitions list should be an unsubscribe operation

ppatierno opened this issue · comments

The Java Apache Kafka consumer API provides the subscribe and assign methods to subscribe to topics or being assigned partitions. The same kind of behaviour is exposed by the bridge via HTTP.
By the way, when using Java Kafka API, providing an empty list of topics to subscribe or an empty list of partitions to the assign acts as an unsubscribe operation. See Kafka consumer code as reference:

https://github.com/apache/kafka/blob/trunk/clients/src/main/java/org/apache/kafka/clients/consumer/KafkaConsumer.java#L960

https://github.com/apache/kafka/blob/trunk/clients/src/main/java/org/apache/kafka/clients/consumer/KafkaConsumer.java#L1110

Actually, in the bridge, when you send a subscribe or assign request with empty topics or partitions list you get the following error:

{
    "error_code": 500,
    "message": "java.lang.IllegalArgumentException: At least one topic to subscribe has to be specified!"
}

We should fix this and providing the same behaviour of the Java Kafka API by doing an unsubscribe.
NOTE: of course, this doesn't apply to the subscription with pattern.

Hi @ppatierno , is this issue still valid and the solution finalized? I'd like to fix this issue based on the requirement? Thank you!

@haijun2022 yes it is still in place. Happy to know you are interested on working on it. I will assign it to you. Let me know if you need any guidance.

thank you, @ppatierno. I will reach out to you in case I need your further support!

Closed by #763