On Wed, Sep 8, 2010 at 2:13 PM, RomualdoGobbo <romualdo.go...@newlog.it> wrote: > > Hi, > I received the same exception error as above, even if you use a consumer > without any sort of selector (see below). > I think that the consumer procedure for some my mistake is not istantiated, > but I don't find the solution. > Excluding the code line with "consumer.receiveBody" all is OK! >
Ah we fixed something for JMS selectors with consumer template a while back. Maybe you need a newer version of Camel. > Many thanks for your help, > Best Regards, > Romualdo > > > > --------------------- BEAN----------------------------> > // 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("file:src/data", > 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); > } > } > } > > -------------------EXCEPTION ERROR-----------------> > > [ New I/O server worker #1-1] Tracer INFO > 38923066-b464-45fb-9a8e-0b63e45a38d9 >>> (route2) from(tcp://localhost:5000) > --> ref:myBeanId method: getTelelinkCommand <<< Pattern:InOut, > Headers:{CamelNettyMessageEvent=[id: 0x012d9844, /127.0.0.1:3013 => > /127.0.0.1:5000] RECEIVED: > $DCS,550700111,100908120155,1,45.57075,9.36793,78,156.5,123456,067F,0,0,,1,00001,000,12.7,214,583,0A10, > CamelNettyRemoteAddress=/127.0.0.1:3013, > camelnettychannelhandlercontext=org.jboss.netty.channel.defaultchannelpipeline$defaultchannelhandlercont...@16c14e7}, > BodyType:String, > Body:$DCS,550700111,100908120155,1,45.57075,9.36793,78,156.5,123456,067F,0,0,,1,00001,000,12.7,214,583,0A10 > after receiving payload: telelink ID = 550700111 > [ New I/O server worker #1-1] DefaultErrorHandler ERROR Failed > delivery for exchangeId: 38923066-b464-45fb-9a8e-0b63e45a38d9. Exhausted > after delivery attempt: 1 caught: java.lang.NullPointerException > java.lang.NullPointerException > -- > View this message in context: > http://camel.465427.n5.nabble.com/Messages-queue-filtered-depending-on-info-received-by-another-queue-tp2805911p2807766.html > Sent from the Camel Development mailing list archive at Nabble.com. > -- Claus Ibsen Apache Camel Committer Author of Camel in Action: http://www.manning.com/ibsen/ Open Source Integration: http://fusesource.com Blog: http://davsclaus.blogspot.com/ Twitter: http://twitter.com/davsclaus