Skip to content

INT-2856:Add support for adding/removing individual recipients to the Re... #1215

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
wants to merge 15 commits into from

Conversation

liujiong1982
Copy link
Contributor

Add support for adding/removing individual recipients to the RecipientListRouter

*
*/
@ManagedResource
public interface RecipientHandler {
Copy link
Contributor

Choose a reason for hiding this comment

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

...Handler is not the right name for this interface (confusion with MessageHandler).

Since we already have MappingMessageRouterManagement; we should call this one RecipientListRouterManagement. Also needs java docs (see MappingMessageRouterManagement).

We also need removeRecipient(String channelName, String expression).

return expressionString;
}

public boolean equals(ExpressionEvaluatingSelector o) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Whenever you implement equals(), you should also implement hashCode() - see the javadoc for Object.equals(). Equal objects must have equal hashcodes - simply use return this.expressionString.hashCode()

@artembilan
Copy link
Member

Again: the push without local testing.
Sad...

@artembilan
Copy link
Member

@liujiong1982 , pay attention, please, how PR should be formed: #1216. The commit message I mean.

@liujiong1982
Copy link
Contributor Author

@artembilan , ControlBusRecipientListRouterTests is the unit test for this. Is it not enough?

@artembilan
Copy link
Member

Hi @liujiong1982 !

Right, the new test is good for new feature, but you should be sure that you break nothing existing.
See: https://travis-ci.org/spring-projects/spring-integration/builds/30551169.
That's why we say in Contribution Guide that there is need to test entire project.

@liujiong1982
Copy link
Contributor Author

fix broken test

1 similar comment
@liujiong1982
Copy link
Contributor Author

fix broken test

@@ -81,6 +81,10 @@

private volatile MessageBuilderFactory messageBuilderFactory;

public String getBeanName() {
return beanName;
}
Copy link
Member

Choose a reason for hiding this comment

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

In my opinion the logic should be not getBeanName() and compare channelIds, but get the channel from BeanFactory and compare objects.
For example FixedSubscriberChannel doesn't extend IntegrationObjectSupport. The same for valid channels from spring-messaging.

Copy link
Contributor

Choose a reason for hiding this comment

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

Good point; sorry @liujiong1982 I pointed you in the wrong direction.

Copy link
Member

Choose a reason for hiding this comment

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

You have forgotten to remove this method...
And don't forget that Docs is a task for this PR too.

MessageSelector selector = next.getSelector();
MessageChannel channel = next.getChannel();
if(selector instanceof ExpressionEvaluatingSelector &&
channel.equals(this.getBeanFactory().getBean(channelName)) &&
Copy link
Member

Choose a reason for hiding this comment

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

Since it is done on each iteration it has to be moved to the beginning of method as local variable

@liujiong1982
Copy link
Contributor Author

Pushed

@liujiong1982
Copy link
Contributor Author

Pushed

@@ -92,15 +136,13 @@ public String getComponentType() {

@Override
public void onInit() throws Exception {
Assert.notEmpty(this.recipients, "recipient list must not be empty");
super.onInit();
}
Copy link
Member

Choose a reason for hiding this comment

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

Since we allow do not configure any recepient this method is becoming redundant

@liujiong1982
Copy link
Contributor Author

Pushed

import org.springframework.messaging.Message;
import org.springframework.messaging.MessageChannel;
import org.springframework.util.Assert;

import reactor.util.StringUtils;
Copy link
Member

Choose a reason for hiding this comment

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

Again Reactor. Be careful everywhere.

@artembilan
Copy link
Member

Polishing for your and @garyrussell review: artembilan@c70e483

@artembilan
Copy link
Member

Merged via 84421fd

@artembilan artembilan closed this Aug 19, 2014
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.

3 participants