Skip to content

Conversation

@danielgentes
Copy link
Contributor

  • Added Events for auth failed
    and successful retry of auth
  • publish of these events
  • unit testing

Closes #2284

* Added Events for auth failed
and successful retry of auth
* publish of these events
* unit testing

Closes spring-projects#2284
Copy link
Contributor

@garyrussell garyrussell left a comment

Choose a reason for hiding this comment

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

Thanks!

Just a few minor nits.

@@ -0,0 +1,77 @@
/*
* Copyright 2018-2022 the original author or authors.
Copy link
Contributor

Choose a reason for hiding this comment

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

New files only need 2022.

package org.springframework.kafka.event;

/**
* An event published when authentication or authorization of a consumer fails and is being retried. Contains the triggering throwable.
Copy link
Contributor

Choose a reason for hiding this comment

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

Please wrap javadocs at 90 chars (code at 120).

}

/**
* Return the reason why the consumer was stopped.
Copy link
Contributor

Choose a reason for hiding this comment

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

Looks like copy/paste.

Return the reason for the auth failure.

/**
* Return the reason why the consumer was stopped.
* @return the reason.
* @since 2.5.8
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
* @since 2.5.8
* @since 2.8.8

@@ -0,0 +1,44 @@
/*
* Copyright 2018-2022 the original author or authors.
Copy link
Contributor

Choose a reason for hiding this comment

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

2022

Implement review suggestions:
* new files only 2022
* copy paste error
* javadoc wrapping
@danielgentes
Copy link
Contributor Author

danielgentes commented Jun 24, 2022

Hi @garyrussell,
thank you for the review! I made the mentioned changes in my latest commit.

Copy link
Member

@artembilan artembilan left a comment

Choose a reason for hiding this comment

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

I think this also has to be mention in the docs: https://docs.spring.io/spring-kafka/docs/current/reference/html/#events.
See kafka.adoc file in the project and modify its Application Events section.

/**
* Return the reason for the auth failure.
* @return the reason.
* @since 2.8.8
Copy link
Member

Choose a reason for hiding this comment

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

This looks like copy/paste from some other class.
Please, remove all the @since in your new classes, but leave that one on the top class level.
You have just introduced the class in 3.0, so it is @since 3.0 with all of its APIs and so on: no reason to duplicate on every method.

}
}

private void publishRetryAuthEvent(Throwable throwable) {
Copy link
Member

Choose a reason for hiding this comment

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

Please, add your name to the @author list: you have made some changes to the class, so you deserve some credit.

given(cf.createConsumer(eq("grp"), eq("clientId"), isNull(), any())).willReturn(consumer);
given(cf.getConfigurationProperties()).willReturn(new HashMap<>());
CountDownLatch latch = new CountDownLatch(2);
CountDownLatch retryEvent = new CountDownLatch(2);
Copy link
Member

Choose a reason for hiding this comment

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

Same here: your name to the @author list.

Implement review suggestions:
* remove @SInCE tags not at top level
* event documentation
* @author on changed classes
* corrected javadoc
@danielgentes
Copy link
Contributor Author

Hi @artembilan ,
thanks for the review! I updated the documentation and also made the other changes you suggested.

@artembilan artembilan merged commit 6fbc6cb into spring-projects:main Jun 24, 2022
@artembilan
Copy link
Member

@danielgentes ,

thank you for contribution; looking forward for more!

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

Successfully merging this pull request may close these issues.

Publish Event In Container when Authorization/Authentication Exception occurs and retry takes place

3 participants