You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Sébastien Foubert <se...@gmail.com> on 2012/11/29 17:46:15 UTC

TimerBasedPooling with selector

Hi,

I use a timer based pooling consumer like this,
http://camel.apache.org/polling-consumer.html#PollingConsumer-Timerbasedpollingconsumer

The difference is that to consume messages, i use a jms selector like this
*  String message =
consumer.receiveBody("activemq:com.xxx.esb.myqueue?selector=JMSTimestamp<"
                   + (System.currentTimeMillis() - this.delay), this.wait,
String.class);*

But, it will create a lot of active openwire connections on queue, that
will be never closed
i tried a consumerTemplate.close() but it does'nt nothing.
When no selector is specified, only one active consumer is present.

i use servicemix 4.4 with camel 2.8 and activemq.

Have you a idea, how to close this connections ?

Thanks,

Sébastien F.

Re: TimerBasedPooling with selector

Posted by Claus Ibsen <cl...@gmail.com>.
On Thu, Nov 29, 2012 at 5:46 PM, Sébastien Foubert
<se...@gmail.com> wrote:
> Hi,
>
> I use a timer based pooling consumer like this,
> http://camel.apache.org/polling-consumer.html#PollingConsumer-Timerbasedpollingconsumer
>
> The difference is that to consume messages, i use a jms selector like this
> *  String message =
> consumer.receiveBody("activemq:com.xxx.esb.myqueue?selector=JMSTimestamp<"
>                    + (System.currentTimeMillis() - this.delay), this.wait,
> String.class);*
>
> But, it will create a lot of active openwire connections on queue, that
> will be never closed
> i tried a consumerTemplate.close() but it does'nt nothing.
> When no selector is specified, only one active consumer is present.
>
> i use servicemix 4.4 with camel 2.8 and activemq.
>
> Have you a idea, how to close this connections ?
>

Try without the consumer template, and invoke close on the consumer yourself.

Lookup the endpoint from the camel context.
Create a PollingConsumer from the endpoint
start the consumer
receive what you need
close the consumer



> Thanks,
>
> Sébastien F.



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
FuseSource is now part of Red Hat
Email: cibsen@redhat.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen