There are a couple of issues with regex subscription in the new consumer:
When consecutive calls are made to new consumer's regex subscription, like below:
the second call fails with the following error:
Even after the code is tweaked to get around the above issue, only the first call to regex subscription triggers an actual subscription and the subscription's rebalance listener. The reason is the regex subscription / poll does not directly call changeSubscription(...) in which needsPartitionAssignment is set and causes a rebalance. This method is called only during the first regex subscription / poll when coordinator is unknown and a client.poll call is made which eventually leads to a changeSubscription call. The subsequent call does not reach this point because the coordinator is already known.
It seems due to the same reason, if a consumer is subscribed to a pattern, and later on a new topic is created that matches that pattern, the consumer does not become subscribed it.