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

Add support for kafka topics regex matching #347

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

jbndbc
Copy link

@jbndbc jbndbc commented Jun 11, 2021

Via @ActivationConfigProperty with propertyName regexTopics

Via @ActivationConfigProperty with propertyName regexTopics
@jbndbc jbndbc marked this pull request as draft June 11, 2021 09:18
@jbndbc jbndbc marked this pull request as ready for review June 11, 2021 10:05
@smillidge
Copy link
Contributor

@jbndbc we don't have a signed CLA on record for you. Could you return one https://github.com/payara/Payara/blob/master/PayaraCLA.pdf

@jbndbc
Copy link
Author

jbndbc commented Jun 28, 2021

@smillidge I have sent a signed CLA to [email protected]

@@ -221,6 +222,14 @@ public void setTopics(String topics) {
this.topics = topics;
}

public String getRegexTopics() {
Copy link
Contributor

@smillidge smillidge Jun 28, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As in the documentation the use of RegExTopics and Topics is mutually exclusive it would be good to add a check in validate and perhaps a WARNING log message if both are set to say that regextopics and topics are both set and regextopics will take precedent. That way if someone has both set they will at least get a hint as to why topics is not having any effect. Alternatively we could be brutal and throw an InvalidPropertyException stating both can not be set?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As it is, the underlying KafkaConsumer actually takes the brutal route and throws an IllegalStateException with the message that "Subscription to topics, partitions and pattern are mutually exclusive".

Would you prefer the solution with WARNING and precedence?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the precedence is done by the code already in the way the ifs are ordered. Only missing point would be the warning part.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Precedence is done via the ifs. I think I need to test creating using the admin console or via deployment rather than annotations to see if the Kafka error is enough.

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

Successfully merging this pull request may close these issues.

3 participants