// TelelinkCommandBean.java package newlog.camel;
import org.apache.camel.*; public class TelelinkCommandBean { private ProducerTemplate producer; private ConsumerTemplate consumer; public void setConsumer(ConsumerTemplate consumer) { this.consumer = consumer; } public void setProducer(ProducerTemplate producer) { this.producer = producer; } public void getTelelinkCommand(Exchange exchange) { String body = null; String bodyTelelink = null; String command = null; String telelink = null; // receive the message from payload exchange body = exchange.getIn().getBody(String.class); telelink = body.substring(5, 14); System.out.println("after receiving payload: telelink ID = " + telelink); // loop to empty queue while (true) { // receive the message from the COMMAND queue bodyTelelink = consumer.receiveBody("jms:toTelelinkQ.filter(body().contains("+ telelink +"))", String.class); if (bodyTelelink == null) { // no more messages in queue break; } if (bodyTelelink.contains("#")) { System.out.println("OK " + telelink + "=" + bodyTelelink); command = bodyTelelink.substring(10); } else { System.out.println("NO OK " + telelink + "<>" + bodyTelelink); command = bodyTelelink; } // send it out the command exchange.getIn().setBody(command); } } } -- View this message in context: http://camel.465427.n5.nabble.com/Messages-queue-filtered-depending-on-info-received-by-another-queue-tp2805911p2807534.html Sent from the Camel Development mailing list archive at Nabble.com.