Skip to content

DefaultDestinationTopicResolver: Inconsistencies In Spring Cloud Environment #1961

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

Closed
yvettequinby opened this issue Sep 27, 2021 · 0 comments · Fixed by #1962
Closed

DefaultDestinationTopicResolver: Inconsistencies In Spring Cloud Environment #1961

yvettequinby opened this issue Sep 27, 2021 · 0 comments · Fixed by #1962

Comments

@yvettequinby
Copy link
Contributor

yvettequinby commented Sep 27, 2021

DefaultDestinationTopicResolver closes the container on ContextRefreshedEvent.

When using Spring Cloud, specifically FeignClient, some components might create a child application context that spring cloud maintains.

See 7.2 - https://cloud.spring.io/spring-cloud-netflix/multi/multi_spring-cloud-feign.html
"A central concept in Spring Cloud’s Feign support is that of the named client. Each feign client is part of an ensemble of components that work together to contact a remote server on demand, and the ensemble has a name that you give it as an application developer using the @FeignClient annotation. Spring Cloud creates a new ensemble as an ApplicationContext on demand for each named client using FeignClientsConfiguration."

This child application contexts are going to be an ApplicationEvent source for the DefaultDestinationTopicResolver component, which is defined as an ApplicationEvent listener.

DefaultDestinationTopicResolver is intended to close the container after a ContextRefreshedEvent.

When there are child application contexts (ContextRefreshedEvent emitters) we end up having some inconsistencies in the DefaultDestinationTopicResolver context lifecycle.

Pull Request: #1962

Affects Version(s): 2.7.2

yvettequinby added a commit to yvettequinby/spring-kafka that referenced this issue Sep 27, 2021
…f event source is the same application context.
yvettequinby added a commit to yvettequinby/spring-kafka that referenced this issue Sep 27, 2021
@artembilan artembilan added this to the 2.8.0-RC1 milestone Sep 27, 2021
@artembilan artembilan self-assigned this Sep 27, 2021
garyrussell pushed a commit that referenced this issue Sep 27, 2021
…loud Environment (#1962)

* GH-1961: Close container on ContextRefreshEvent only if event source is the same application context.

* GH-1961: Updated Javadoc
garyrussell pushed a commit that referenced this issue Sep 27, 2021
…loud Environment (#1962)

* GH-1961: Close container on ContextRefreshEvent only if event source is the same application context.

* GH-1961: Updated Javadoc
garyrussell added a commit to garyrussell/spring-kafka that referenced this issue Sep 27, 2021
- rename field to something more meaningful
- just compare the contexts in the event listener

**cherry-pick to 2.7.x**
artembilan pushed a commit that referenced this issue Sep 27, 2021
- rename field to something more meaningful
- just compare the contexts in the event listener

**cherry-pick to 2.7.x**
artembilan pushed a commit that referenced this issue Sep 27, 2021
- rename field to something more meaningful
- just compare the contexts in the event listener

**cherry-pick to 2.7.x**
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants