[ 
https://issues.apache.org/jira/browse/KAFKA-15538?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17807783#comment-17807783
 ] 

Lianet Magrans commented on KAFKA-15538:
----------------------------------------

Hey [~phuctran], you're right that the intention is that this section 
[here|https://github.com/apache/kafka/blob/dd0916ef9a6276d191196f79176bcb725e1ff9e6/clients/src/main/java/org/apache/kafka/clients/consumer/internals/HeartbeatRequestManager.java#L537]
 where the regex is sent in the HB request, should apply only to the 
SubscriptionPattern, but that's not what the current implementation achieves. 
With the current code, it would apply the section also to the Pattern, because 
the check is done based on #hasPatternSubscription (the moment we call 
[subscribe(Pattern..)|https://github.com/apache/kafka/blob/26465c64092868c972e2a0e4d9a4fc0ed13a7a39/clients/src/main/java/org/apache/kafka/clients/consumer/internals/AsyncKafkaConsumer.java#L1719]
 the subscription state will have subscription type AUTO_PATTERN so 
#hasPatternSubscription will be true). 

> Client support for java regex based subscription
> ------------------------------------------------
>
>                 Key: KAFKA-15538
>                 URL: https://issues.apache.org/jira/browse/KAFKA-15538
>             Project: Kafka
>          Issue Type: Sub-task
>          Components: clients, consumer
>            Reporter: Lianet Magrans
>            Assignee: Phuc Hong Tran
>            Priority: Major
>              Labels: kip-848, kip-848-client-support
>             Fix For: 3.8.0
>
>
> When using subscribe with a java regex (Pattern), we need to resolve it on 
> the client side to send the broker a list of topic names to subscribe to.
> Context:
> The new consumer group protocol uses [Google 
> RE2/J|https://github.com/google/re2j] for regular expressions and introduces 
> new methods in the consumer API to subscribe using a `SubscribePattern`. The 
> subscribe using a java `Pattern` will be still supported for a while but 
> eventually removed.
>  * When the subscribe with SubscriptionPattern is used, the client should 
> just send the regex to the broker and it will be resolved on the server side.
>  * In the case of the subscribe with Pattern, the regex should be resolved on 
> the client side.
> As part of this task, we should re-enable all integration tests defined in 
> the PlainTextAsyncConsumer that relate to subscription with pattern and that 
> are currently disabled for the new consumer + new protocol



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to