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

INT-3107 Fix TCP Syslog ApplicationEventPublisher #835

Merged
merged 1 commit into from Aug 8, 2013

Conversation

garyrussell
Copy link
Contributor

No publisher was injected if the default embedded connection
factory was used.

protected void onInit() {
super.onInit();
if (this.connectionFactory == null) {
this.connectionFactory = new TcpNioServerConnectionFactory(this.getPort());
this.connectionFactory.setDeserializer(new ByteArrayLfSerializer());
if (this.applicationEventPublisher != null) {
this.connectionFactory.setApplicationEventPublisher(this.applicationEventPublisher);
}
Copy link
Member

Choose a reason for hiding this comment

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

Good evening, Gary!
How about to move this new if after if (this.connectionFactory == null), not within the last one?
TcpSyslogReceivingChannelAdapter can be a bean, but connectionFactory I can set manually without dependencies - it might be not a bean.
All others - LGTM

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I see what you mean, but I really don't want to override a custom publisher that might have been set on a non-bean factory that was injected.

If someone does that, but fails to give it a publisher, they'll see the WARN log.

I suppose we could add a getter and only replace it if it's null (if you really feel strongly about it), but my feeling is to leave it like it is.

Copy link
Member

Choose a reason for hiding this comment

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

No, it's OK. The dirrect object injection (not a bean) is a extravagant case. And WARN will say about the issue.

No publisher was injected if the default embedded connection
factory was used.
@artembilan
Copy link
Member

Hi, Gay!
LGTM.
Let's merge it.

@garyrussell garyrussell merged commit d6776b4 into spring-projects:master Aug 8, 2013
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.

None yet

2 participants