You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@camel.apache.org by wow <wo...@163.com> on 2012/03/26 12:01:56 UTC
Only one endpoint can follow to the split bean ?
Hi:
I use spliter pattern to deep copy message according by a attribute in message. The route rule as follows:
<route>
<from ......../>
<split>
<method ref="splitter" method="split"/>
<to uri="jbi:service:http://cobweb.hongbo.net.cn/default/master/router" />
<recipientList>
<header>CW_MSG_DESTINATION_ENDPOINT_URI</header>
</recipientList>
</split>
</route>
and the 'split' method of 'splitter' bean :
public class SplitterMsgByConsumer {
/**
*
* @param consumers consumer attribute in message header
* <ul>
* <li>single user format: <b>username@domain</b>.</li>
* <li>mutil user format: <b>username@domain,usename@domain...</b></li>
* </ul>
* @param msg in message
* @return a collection containing messages splitted by the method
* @throws Exception
*/
public List<Message> split(@Header(MessageHeader.CW_MSG_CONSUMER) String consumers,
Message msg) throws Exception
{
String topName = System.getProperty(ZooKeeperConfig.ZOOKEEPER_ZNODE_TOPNAME);
if(StringUtils.isEmpty(consumers)) {
throw new IllegalStateException("In master process of Cobweb[" + topName + "], "
+ "the consumer attribute of message exchange[ID:] is not founded");
}
List<Message> messages = new ArrayList<Message>();
String[] parters = consumers.split(",");
for (String parter : parters) {
Message copyMsg = msg.copy();
copyMsg.setHeader(MessageHeader.CW_MSG_CONSUMER, parter);
messages.add(copyMsg);
}
return messages;
}
}
The endpoint marked with uri 'jbi:service:http://cobweb.hongbo.net.cn/default/master/router' can received messages, the count is equal to the size of messages list returned by splitter bean.
But only one endpoint dynamically marked with recipientList pattern can received its own message. Another endpoint can't receive messages belong to itself.
How can I find the lost message. 2(upflow) = 1 (one endpoint) + 1 ( another endpoint).
thank you for your response.
Re: Only one endpoint can follow to the split bean ?
Posted by Reuben Garrett <re...@gmail.com>.
wow,
I'd like to move this discussion to the user list since you have usage
concerns.
my only suggestion is to use log [1] or tracer [2] to help diagnose that
routing details (e.g. headers) match their expected values. the commiters
will be able to give further insight.
[1]: http://camel.apache.org/log.html
[2]: http://camel.apache.org/tracer.html
~ Reuben
On Monday, March 26, 2012, wow <wo...@163.com> wrote:
> I use spliter pattern to deep copy message according by a attribute
in message. The route rule as follows:
>
> <route>
> <from ......../>
> <split>
> <method ref="splitter" method="split"/>
> <to uri="jbi:service:
http://cobweb.hongbo.net.cn/default/master/router" />
> <recipientList>
>
<header>CW_MSG_DESTINATION_ENDPOINT_URI</header>
> </recipientList>
> </split>
> </route>
>
> The endpoint marked with uri 'jbi:service:
http://cobweb.hongbo.net.cn/default/master/router' can received messages,
the count is equal to the size of messages list returned by splitter bean.
> But only one endpoint dynamically marked with recipientList pattern can
received its own message. Another endpoint can't receive messages belong to
itself.
>
> How can I find the lost message. 2(upflow) = 1 (one endpoint) + 1 (
another endpoint).
Re: Only one endpoint can follow to the split bean ?
Posted by Reuben Garrett <re...@gmail.com>.
wow,
I'd like to move this discussion to the user list since you have usage
concerns.
my only suggestion is to use log [1] or tracer [2] to help diagnose that
routing details (e.g. headers) match their expected values. the commiters
will be able to give further insight.
[1]: http://camel.apache.org/log.html
[2]: http://camel.apache.org/tracer.html
~ Reuben
On Monday, March 26, 2012, wow <wo...@163.com> wrote:
> I use spliter pattern to deep copy message according by a attribute
in message. The route rule as follows:
>
> <route>
> <from ......../>
> <split>
> <method ref="splitter" method="split"/>
> <to uri="jbi:service:
http://cobweb.hongbo.net.cn/default/master/router" />
> <recipientList>
>
<header>CW_MSG_DESTINATION_ENDPOINT_URI</header>
> </recipientList>
> </split>
> </route>
>
> The endpoint marked with uri 'jbi:service:
http://cobweb.hongbo.net.cn/default/master/router' can received messages,
the count is equal to the size of messages list returned by splitter bean.
> But only one endpoint dynamically marked with recipientList pattern can
received its own message. Another endpoint can't receive messages belong to
itself.
>
> How can I find the lost message. 2(upflow) = 1 (one endpoint) + 1 (
another endpoint).