Skip to content

Fix DSL to deal with beanNames for handlers #2707

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

Merged
merged 2 commits into from
Jan 22, 2019

Conversation

artembilan
Copy link
Member

When consumer endpoint is created by the Framework, the target
MessageHandler gets a componentName from the ConsumerEndpointFactoryBean.
Therefore we can't rely on the getComponentName() when we create beans
from Java DSL.

  • Introduce NamedComponent.getBeanName() contract; make it default
    to the getComponentName(); implement this method from the
    IntegrationObjectSupport
  • Use this new getBeanName() from the IntegrationFlowBeanPostProcessor
    and StandardIntegrationFlowContext for better existing beans checks
    and possible reuse existing MessageHandler in different endpoints
  • Optimize FixedSubscriberChannel and implement getBeanName() over there
  • Implement getBeanName() in the AbstractMessageSource; use
    ExpressionEvalMap to evaluate headers expressions
  • Implement getBeanName() in Trackable*Metrics classes as delegation
    to the this.trackable

When consumer endpoint is created by the Framework, the target
`MessageHandler` gets a `componentName` from the `ConsumerEndpointFactoryBean`.
Therefore we can't rely on the `getComponentName()` when we create beans
from Java DSL.

* Introduce `NamedComponent.getBeanName()` contract; make it default
to the `getComponentName()`; implement this method from the
`IntegrationObjectSupport`
* Use this new `getBeanName()` from the `IntegrationFlowBeanPostProcessor`
and `StandardIntegrationFlowContext` for better existing beans checks
and possible reuse existing `MessageHandler` in different endpoints
* Optimize `FixedSubscriberChannel` and implement `getBeanName()` over there
* Implement `getBeanName()` in the `AbstractMessageSource`; use
`ExpressionEvalMap` to evaluate headers expressions
* Implement `getBeanName()` in `Trackable*Metrics` classes as delegation
to the `this.trackable`
@artembilan artembilan added this to the 5.1.3 milestone Jan 18, 2019
this.discardChannelName = null;
}
}
this.discardChannel = getChannelResolver().resolveDestination(this.discardChannelName);
Copy link
Contributor

Choose a reason for hiding this comment

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

Possible NPE here when 2 concurrent threads.

@garyrussell garyrussell merged commit d37e656 into spring-projects:master Jan 22, 2019
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.

2 participants