camel-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From RomualdoGobbo <>
Subject Messages queue filtered depending on info received by another queue
Date Tue, 07 Sep 2010 10:30:53 GMT

Hi All,
I've the following problem unsolved regarding the filtered messages
depending on some info extractect from another queue.

The case is the following:

1. Primary queue contains the messages received from netty:tcp server
2.Depending the ID found in the body you have to select from another queue
only the messages affected to the previous ID, leaving the other messages in
the queue.
3. The returning message will be the message (if found) on the second queue,
otherwise all remains unchanged.

I've solved only partially the problem using the following camelcontext.xml:

    	<from uri="netty:tcp://localhost:5000?textline=true&amp;sync=true"/>
    	<to uri="jms:MyQueue"/>
 	    <pollEnrich uri="jms:toTelelinkQ" strategyRef="myBeanId"/>
	</route>  -->

	<bean id="myBeanId" class="org.apache.camel.example.MyBeanProcessor"/>

due to the process myBeanId that is unable to leave the messages in the
original queue (see the following code), but all messages must be consumed
to know the body content:


package org.apache.camel.example;


import org.apache.camel.Exchange;
import org.apache.camel.processor.aggregate.AggregationStrategy;

public class MyBeanProcessor implements AggregationStrategy {

	public Exchange aggregate(Exchange oldExchange, Exchange newExchange) {

		if (newExchange == null) {
			// no messages in queue
			return newExchange;
		String payloadOld = oldExchange.getIn().getBody(String.class);
		String payloadNew = newExchange.getIn().getBody(String.class);

		String telelink = payloadOld.substring(5, 14);

		if (payloadNew.contains("#") & payloadNew.contains(telelink)) {
			System.out.println("OK " + telelink + "=" + payloadNew);
		} else {
			System.out.println("NO OK " + telelink + "<>" + payloadNew);

		return oldExchange;

Many thanks for your help,
View this message in context:
Sent from the Camel Development mailing list archive at

View raw message