[ 
https://issues.apache.org/jira/browse/CAMEL-4650?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13147042#comment-13147042
 ] 

Babak Vahdat edited comment on CAMEL-4650 at 11/9/11 3:47 PM:
--------------------------------------------------------------

@Tarjei, could you please give me some hints:

Are your both routes (you called them the main & the drainer one) in the same 
camel context? If so I wonder how it should work *at all* as you would consume 
twice using exactly the same seda uri in the same camel context as soon as you 
start the drainer route (for example through jmx)! IMHO the camel behaviour in 
this case would be undefined / unpredictable when a new message would arrive at 
this time to the seda endpoint.

The Java-DSL doesn't inhibit you to do that and the code would of course 
compile but at runtime using the from() clause you would *concurrently* consume 
twice using the same seda endpoint java object, again the uri by both routes 
seems to me to be exactly the same:

{code}
from("seda:" + sedaId + "?size=1000")
{code}

I propose to use the try/catch or onException clause to send the failed 
messsages (the not processed ones) to some endpoints (for example 
"direct:failed") and as soon as you start the drainer route you would consume 
from that endpoint in drainer route instead of consuming *concurrently* from 
the seda endpoint together with the main route at *the same time*.

What do you think?
                
      was (Author: bvahdat):
    @Tarjei, could you please give me some hints:

Are your both routes (you called them the main & the drainer one) in the same 
camel context? If so I wonder how it should work *at all* as you would consume 
twice using the same seda URI in the same camel context!

The Java-DSL doesn't inhibit you to do that and the code would of course 
compile but at runtime using the from() clause you would *concurrently* consume 
twice using the same seda endpoint object, again the URI in both routes seem to 
me to be exactly the same:

{code}
from("seda:" + sedaId + "?size=1000")
{code}

Or am I wrong?
                  
> NPE when using SEDA route and attaching an extra consumer
> ---------------------------------------------------------
>
>                 Key: CAMEL-4650
>                 URL: https://issues.apache.org/jira/browse/CAMEL-4650
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-core
>    Affects Versions: 2.8.2
>         Environment: Java 6, Camel 2.8.2, Centos 4.
>            Reporter: Tarjei Huse
>
> I'm trying to construct a system for moving some seda queues over to
> ActiveMQ during system shutdown. What I did was create a Route that
> connects to some of my seda queues and then drains the queue to activemq.
> Basicly I got two routes, the drainer:
> from("seda:" + sedaId + "?size=1000")
>                     .routeId(routeName +
> sedaIs).noAutoStartup().to(activeMQFailuresQueue);
> And the main route:
> from("seda:" + sedaId + "?size=1000")
>                     .routeId(routeName + sedaIs).to(SomeProcessor);
> Now, sometimes the main route stalls for various reasons I need to
> restart the jvm process it is running in, so I start the first route.
> But when trying this in production, I got:
>  java.lang.NullPointerException
>     at
> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:78)
>     at
> org.apache.camel.component.seda.SedaConsumer.sendToConsumers(SedaConsumer.java:210)
>     at
> org.apache.camel.component.seda.SedaConsumer.doRun(SedaConsumer.java:155)
>     at
> org.apache.camel.component.seda.SedaConsumer.run(SedaConsumer.java:129)
>     at
> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
>     at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
>     at java.lang.Thread.run(Thread.java:619)
> Bvahdat added a comment:
> just a very tiny pointer:
> Looking at the source it seems that  the
> SedaEndpoint.getConsumerMulticastProcessor() method returns 'null' causing
> the NPE, as the condition:
> multicastStarted == false || consumerMulticastProcessor == null
> is true.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to