camel-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "wow" <>
Subject Only one endpoint can follow to the split bean ?
Date Mon, 26 Mar 2012 10:01:56 GMT
      I use spliter pattern to deep copy message according by a attribute in message.  The
route rule as follows: 

        <from ......../>
 			 <method ref="splitter" method="split"/>
 			 <to uri="jbi:service:" />

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);
        return messages;

   The endpoint marked with uri 'jbi:service:'
can received messages, the count is equal to the size of messages list returned by splitter
   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
View raw message