...
The return value of the @RecipientList method is converted to either a java.util.Collection / java.util.Iterator or array of objects where each element is converted to an Endpoint or a String, or if you are only going to route to a single endpoint then just return either an Endpoint object or an object that can be converted to a String Then for each endpoint or URI the message is forwarded a separate copy. The . So the following methods are all valid
Code Block | ||||
---|---|---|---|---|
| ||||
@RecipientList public String[] route(String body) { ... } @RecipientList public List<String> route(String body) { ... } @RecipientList public Endpoint route(String body) { ... } @RecipientList public Endpoint[] route(String body) { ... } @RecipientList public Collection<Endpoint> route(String body) { ... } @RecipientList public URI route(String body) { ... } @RecipientList public URI[] route(String body) { ... } |
Then for each endpoint or URI the message is forwarded a separate copy to that endpoint.
You can then use whatever Java code you wish to figure out what endpoints to route to; for example you can use the Bean Binding annotations to inject parts of the message body or headers or use Expression values on the message.
...