camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Carlos Manuel Figueiredo <>
Subject RE: Queue/Dequeue perfomance InOut ExchangePattern
Date Mon, 21 Nov 2011 16:38:54 GMT
How do I use ConsumerTemplate?

This is my attempt. Created a new Processor:

// Dequeue
.when(and(header("CamelHttpUri").regex(".*/my-queue.*"), header("CamelHttpMethod").isEqualTo("GET")))
	.process(new InOutProcessor())

And inside it I do this:
private class InOutProcessor implements Processor {    	
    	private ConsumerTemplate consumer;
    	public void process(Exchange exchange) throws Exception {
    		exchange.getIn().setHeader("Content-Type", constant("application/xml"));	 
    		consumer.receiveBody("my-queue-endpoint ");

But the consumer I created is allways null and returns a NullPointer. How do I initialize

I also didn't understand what you ment whet saying I could use two inOnly routes instead of
one InOut. Can you give me and examples?

Best regards,
Carlos Figueiredo

-----Original Message-----
From: Christian Müller [] 
Sent: sexta-feira, 18 de Novembro de 2011 18:39
Subject: Re: Queue/Dequeue perfomance InOut ExchangePattern

If you use an embedded broker, you should consider using the VM
(vm://brokerName) protocol instead of TCP (tcp://localhost:61616). But this
has nothing to do with your issue... ;-)

If you have to achieve high throughput, you should consider using async
messaging (two inOnly routes instead of one InOut). But that's what you

What's about using the ConsumerTemplate to receive messages instead the
PollConsumer? It sounds more correct for me, because you only want to
return one messages as I understood your route...


View raw message