-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Conversation
… RecipientListRouter
… RecipientListRouter
* | ||
*/ | ||
@ManagedResource | ||
public interface RecipientHandler { |
There was a problem hiding this comment.
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)
.
… RecipientListRouter
… RecipientListRouter
… RecipientListRouter
return expressionString; | ||
} | ||
|
||
public boolean equals(ExpressionEvaluatingSelector o) { |
There was a problem hiding this comment.
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()
Again: the push without local testing. |
@liujiong1982 , pay attention, please, how PR should be formed: #1216. The commit message I mean. |
@artembilan , ControlBusRecipientListRouterTests is the unit test for this. Is it not enough? |
Hi @liujiong1982 ! Right, the new test is good for new feature, but you should be sure that you break nothing existing. |
fix broken test |
1 similar comment
fix broken test |
@@ -81,6 +81,10 @@ | |||
|
|||
private volatile MessageBuilderFactory messageBuilderFactory; | |||
|
|||
public String getBeanName() { | |||
return beanName; | |||
} |
There was a problem hiding this comment.
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 channelId
s, but get the channel from BeanFactory
and compare objects.
For example FixedSubscriberChannel
doesn't extend IntegrationObjectSupport
. The same for valid channels from spring-messaging
.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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)) && |
There was a problem hiding this comment.
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
Pushed |
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(); | |||
} |
There was a problem hiding this comment.
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
Pushed |
import org.springframework.messaging.Message; | ||
import org.springframework.messaging.MessageChannel; | ||
import org.springframework.util.Assert; | ||
|
||
import reactor.util.StringUtils; |
There was a problem hiding this comment.
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.
Polishing for your and @garyrussell review: artembilan@c70e483 |
Merged via 84421fd |
Add support for adding/removing individual recipients to the RecipientListRouter