You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by boday <bo...@vektrel.com> on 2010/03/08 23:27:45 UTC

DirectProducer - no consumers available on endpoint...message is lost

I have a polling consumer setup to periodically (using camel-timer) retry
messages from an error queue. 

like this...

//initialized in constructor of polling consumer
private static ProducerTemplate producer = context.createProducerTemplate();
...
Exchange exchange = consumer.receive("activemq:errorQueue", 100);
String msgBody = exchange.getIn().getBody(String.class);
producer.sendBody("direct::Decoder", msgBody);

Every now and then, I get the following warning in my logs...

WARN  - DirectProducer                 - No consumers available on endpoint:
Endpoint[direct://Decoder]

Whenever this happens, the message being sent to this endpoint is lost!!!  I
know the endpoint is active and started, so what would cause it to have "no
consumers available"?  

Also, is there a way for my polling consumer to detect/handle this case so
that the message isn't lost and simply waits for an unavailable consumer to
become available?

thanks

-----
Ben - Senior Consultant
using SMX 3.3.1/Camel 2.1
-- 
View this message in context: http://old.nabble.com/DirectProducer---no-consumers-available-on-endpoint...message-is-lost-tp27828628p27828628.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: DirectProducer - no consumers available on endpoint...message is lost

Posted by Stephen Gargan <st...@gmail.com>.
Is there any way that the consumer on direct:decode could be getting
stopped. This is the only way that you could get the No Consumers
error. If you could boil the issue down into a unit test it would
really help.

One thing you might try is to avoid sending messages from the error
queue while the route is stopped. You could set up another route with
a timer to poll from the error queue. You could then easily stop both.

ste

On Tue, Mar 9, 2010 at 8:56 AM, boday <bo...@vektrel.com> wrote:
>
> Sorry, please ignore my typos in the route (I use constants for all
> endpoints, but tried to simplify it for the post).
>
> Does "no consumers available" mean the route isn't active or that there
> aren't any available threads?  Also, where does the message go exactly?  Is
> there a way to handle this case in my route and send it to an error queue?
>
> As for the ordering, I don't explicitly define this now.  But, I don't think
> its an issue because everything works fine on startup...the issue only shows
> up after hours of normal operation.
>
> I do stop/start this first route on certain errors (database down, etc)...
>
>                from(INBOUND_QUEUE).routeId(INBOUND_QUEUE)
>                        .to(DECODE_DIRECT);
>
>                with this code...
>
>                ServiceStatus routeStatus = context.getRouteStatus(INBOUND_QUEUE);
>                if(routeStatus.isStoppable())
>                {
>                        context.stopRoute(INBOUND_QUEUE);
>                }
>
>                ...//retry database connection, if successful, restart
>
>                if(routeStatus.isStartable())
>                {
>                        context.startRoute(INBOUND_QUEUE);
>                }
>
> But, I don't ever stop the DECODE_DIRECT route itself.  If I were stopping
> that route, then I'd expect to see an error saying that the route hasn't
> been started or is unavailable.
>
> thanks again...
>
>
>
> -----
> Ben - Senior Consultant
> using SMX 3.3.1/Camel 2.1
> --
> View this message in context: http://old.nabble.com/DirectProducer---no-consumers-available-on-endpoint...message-is-lost-tp27828628p27838518.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>

Re: DirectProducer - no consumers available on endpoint...message is lost

Posted by boday <bo...@vektrel.com>.
Sorry, please ignore my typos in the route (I use constants for all
endpoints, but tried to simplify it for the post).

Does "no consumers available" mean the route isn't active or that there
aren't any available threads?  Also, where does the message go exactly?  Is
there a way to handle this case in my route and send it to an error queue?

As for the ordering, I don't explicitly define this now.  But, I don't think
its an issue because everything works fine on startup...the issue only shows
up after hours of normal operation.

I do stop/start this first route on certain errors (database down, etc)...

		from(INBOUND_QUEUE).routeId(INBOUND_QUEUE)
			.to(DECODE_DIRECT);

                with this code...

		ServiceStatus routeStatus = context.getRouteStatus(INBOUND_QUEUE);
		if(routeStatus.isStoppable())
		{
	    		context.stopRoute(INBOUND_QUEUE);
		}

                ...//retry database connection, if successful, restart

		if(routeStatus.isStartable())
		{
	    		context.startRoute(INBOUND_QUEUE);
		}

But, I don't ever stop the DECODE_DIRECT route itself.  If I were stopping
that route, then I'd expect to see an error saying that the route hasn't
been started or is unavailable.

thanks again...



-----
Ben - Senior Consultant
using SMX 3.3.1/Camel 2.1
-- 
View this message in context: http://old.nabble.com/DirectProducer---no-consumers-available-on-endpoint...message-is-lost-tp27828628p27838518.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: DirectProducer - no consumers available on endpoint...message is lost

Posted by Willem Jiang <wi...@gmail.com>.
Hi,

I just checked the code of DirectProducer , DirectConsumer, 
DirectEndpoint, the code should be thread safe, unless you stop the 
route dynamically.
So please check if you choice a right director endpoint name first.

Willem

Stephen Gargan wrote:
> Not to harp about the endpoint uri but I just want to get them correct
> so I can try and reproduce. In one you have direct:decode and and in
> others direct:decoder. Are they consistent in your code?
> 
> thanks
> 
> ste
> 
> On Mon, Mar 8, 2010 at 5:03 PM, boday <bo...@vektrel.com> wrote:
>> yes, the retry does work fine 99% of the time...randomly we see this error
>> after many successful retries of of other messages, etc...
>>
>> -----
>> Ben - Senior Consultant
>> using SMX 3.3.1/Camel 2.1
>> --
>> View this message in context: http://old.nabble.com/DirectProducer---no-consumers-available-on-endpoint...message-is-lost-tp27828628p27830046.html
>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>
>>
> 


Re: DirectProducer - no consumers available on endpoint...message is lost

Posted by Stephen Gargan <st...@gmail.com>.
Not to harp about the endpoint uri but I just want to get them correct
so I can try and reproduce. In one you have direct:decode and and in
others direct:decoder. Are they consistent in your code?

thanks

ste

On Mon, Mar 8, 2010 at 5:03 PM, boday <bo...@vektrel.com> wrote:
>
> yes, the retry does work fine 99% of the time...randomly we see this error
> after many successful retries of of other messages, etc...
>
> -----
> Ben - Senior Consultant
> using SMX 3.3.1/Camel 2.1
> --
> View this message in context: http://old.nabble.com/DirectProducer---no-consumers-available-on-endpoint...message-is-lost-tp27828628p27830046.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>

Re: DirectProducer - no consumers available on endpoint...message is lost

Posted by boday <bo...@vektrel.com>.
yes, the retry does work fine 99% of the time...randomly we see this error
after many successful retries of of other messages, etc...

-----
Ben - Senior Consultant
using SMX 3.3.1/Camel 2.1
-- 
View this message in context: http://old.nabble.com/DirectProducer---no-consumers-available-on-endpoint...message-is-lost-tp27828628p27830046.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: DirectProducer - no consumers available on endpoint...message is lost

Posted by Stephen Gargan <st...@gmail.com>.
 You say

"Every now and then, I get the following warning in my logs...

WARN  - DirectProducer                 - No consumers available on endpoint:
Endpoint[direct://Decoder]"

This wouldn't happen to coincide with your timer would it? Does the
polling consumer ever succeed or does it always give the no consumers
error?


On Mon, Mar 8, 2010 at 3:38 PM, boday <bo...@vektrel.com> wrote:
>
> sorry, the '::' was a typo in my post only...
>
> the route works fine during normal execution...basically the following
>
> from('activemq:inbound')
> .to('direct:decode');
>
> from('direct:decode')
> .convertBodyTo(DOMSource.class)
> .process(new DecodeProcessor())
> .process(new ValidateProcessor())
> .process(new PersistProcessor());
>
> I'm using a single Camel context and have 50 MaxConcurrentConsumers set on
> the AMQ component.  I'm doing high volume (~200 msg/s) message processing.
>
> My polling consumer routes traffic to the 'direct:decode' endpoint so it
> will get processed immediately (rather than going to the 'inbound' queue).
> It seems like this might be the issue in that both the inbound queue route
> and my polling consumer are competing for the same 'direct:decode'
> consumers??
>
>
>
> -----
> Ben - Senior Consultant
> using SMX 3.3.1/Camel 2.1
> --
> View this message in context: http://old.nabble.com/DirectProducer---no-consumers-available-on-endpoint...message-is-lost-tp27828628p27829374.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>

Re: DirectProducer - no consumers available on endpoint...message is lost

Posted by boday <bo...@vektrel.com>.
sorry, the '::' was a typo in my post only...

the route works fine during normal execution...basically the following

from('activemq:inbound')
.to('direct:decode');

from('direct:decode')
.convertBodyTo(DOMSource.class)
.process(new DecodeProcessor())
.process(new ValidateProcessor())
.process(new PersistProcessor());

I'm using a single Camel context and have 50 MaxConcurrentConsumers set on
the AMQ component.  I'm doing high volume (~200 msg/s) message processing.

My polling consumer routes traffic to the 'direct:decode' endpoint so it
will get processed immediately (rather than going to the 'inbound' queue). 
It seems like this might be the issue in that both the inbound queue route
and my polling consumer are competing for the same 'direct:decode'
consumers??



-----
Ben - Senior Consultant
using SMX 3.3.1/Camel 2.1
-- 
View this message in context: http://old.nabble.com/DirectProducer---no-consumers-available-on-endpoint...message-is-lost-tp27828628p27829374.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: DirectProducer - no consumers available on endpoint...message is lost

Posted by Stephen Gargan <st...@gmail.com>.
Do you have something listening on the direct endpoint? How do you
have it configured? I see you've an extra colon in the endpoint uri
here; Does the route consuming this direct endpoint also use
"direct::Decoder" or just "direct:Decoder".

Are you using a single camel context? If you post the direct consumer
route we'll be able to help you more.

ste

On Mon, Mar 8, 2010 at 2:27 PM, boday <bo...@vektrel.com> wrote:
>
> I have a polling consumer setup to periodically (using camel-timer) retry
> messages from an error queue.
>
> like this...
>
> //initialized in constructor of polling consumer
> private static ProducerTemplate producer = context.createProducerTemplate();
> ...
> Exchange exchange = consumer.receive("activemq:errorQueue", 100);
> String msgBody = exchange.getIn().getBody(String.class);
> producer.sendBody("direct::Decoder", msgBody);
>
> Every now and then, I get the following warning in my logs...
>
> WARN  - DirectProducer                 - No consumers available on endpoint:
> Endpoint[direct://Decoder]
>
> Whenever this happens, the message being sent to this endpoint is lost!!!  I
> know the endpoint is active and started, so what would cause it to have "no
> consumers available"?
>
> Also, is there a way for my polling consumer to detect/handle this case so
> that the message isn't lost and simply waits for an unavailable consumer to
> become available?
>
> thanks
>
> -----
> Ben - Senior Consultant
> using SMX 3.3.1/Camel 2.1
> --
> View this message in context: http://old.nabble.com/DirectProducer---no-consumers-available-on-endpoint...message-is-lost-tp27828628p27828628.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>

Re: DirectProducer - no consumers available on endpoint...message is lost

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

You need to configure the startup order of your routes so the timer is
the last one to be started
http://camel.apache.org/configuring-route-startup-ordering-and-autostartup.html


On Mon, Mar 8, 2010 at 11:27 PM, boday <bo...@vektrel.com> wrote:
>
> I have a polling consumer setup to periodically (using camel-timer) retry
> messages from an error queue.
>
> like this...
>
> //initialized in constructor of polling consumer
> private static ProducerTemplate producer = context.createProducerTemplate();
> ...
> Exchange exchange = consumer.receive("activemq:errorQueue", 100);
> String msgBody = exchange.getIn().getBody(String.class);
> producer.sendBody("direct::Decoder", msgBody);
>
> Every now and then, I get the following warning in my logs...
>
> WARN  - DirectProducer                 - No consumers available on endpoint:
> Endpoint[direct://Decoder]
>
> Whenever this happens, the message being sent to this endpoint is lost!!!  I
> know the endpoint is active and started, so what would cause it to have "no
> consumers available"?
>
> Also, is there a way for my polling consumer to detect/handle this case so
> that the message isn't lost and simply waits for an unavailable consumer to
> become available?
>
> thanks
>
> -----
> Ben - Senior Consultant
> using SMX 3.3.1/Camel 2.1
> --
> View this message in context: http://old.nabble.com/DirectProducer---no-consumers-available-on-endpoint...message-is-lost-tp27828628p27828628.html
> Sent from the Camel - Users 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