You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@camel.apache.org by Sumit <su...@gmail.com> on 2015/04/27 17:34:38 UTC
Camel resequencer() is not working inside choice - java dsl
Hi,
I have applied the resequencer() function conditionally like the following
example:
from(...)
.choice()
.when(...)
.resequence(header(...)).stream()
.endchoice()
.when(...)
.resequence(header(...)).stream()
.endchoice()
.recipientList(...)
.end()
The following message is coming:
org.apache.camel.FailedToCreateRouteException: Failed to create route XYZ
at: >>> Choice[[When[{header{SequenceNumber} is not null} ->
[Resequencer[header{SequenceNumber} -> []]]]] Otherwise[[]]] <<< in route:
Route(XYZ)[[From[gvjms:queue:ABC]] -> [OnException[... because of Definition
has no children on Resequencer[header{SequenceNumber} -> []]
at
org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:912)
at
org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:177)
at
org.apache.camel.impl.DefaultCamelContext.startRoute(DefaultCamelContext.java:770)
at
org.apache.camel.impl.DefaultCamelContext.startRouteDefinitions(DefaultCamelContext.java:1914)
at
org.apache.camel.impl.DefaultCamelContext.doStartCamel(DefaultCamelContext.java:1670)
at
org.apache.camel.impl.DefaultCamelContext.doStart(DefaultCamelContext.java:1544)
at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61)
at
org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:1512)
at
Caused by: java.lang.IllegalArgumentException: Definition has no children on
Resequencer[header{SequenceNumber} -> []]
at
org.apache.camel.model.ProcessorDefinition.createChildProcessor(ProcessorDefinition.java:182)
at
org.apache.camel.model.ResequenceDefinition.createStreamResequencer(ResequenceDefinition.java:378)
at
org.apache.camel.model.ResequenceDefinition.createProcessor(ResequenceDefinition.java:326)
at
org.apache.camel.model.ProcessorDefinition.createProcessor(ProcessorDefinition.java:460)
at
org.apache.camel.model.ProcessorDefinition.createOutputsProcessor(ProcessorDefinition.java:429)
at
org.apache.camel.model.ProcessorDefinition.createOutputsProcessor(ProcessorDefinition.java:159)
at
org.apache.camel.model.ExpressionNode.createFilterProcessor(ExpressionNode.java:109)
at
org.apache.camel.model.WhenDefinition.createProcessor(WhenDefinition.java:77)
at
org.apache.camel.model.WhenDefinition.createProcessor(WhenDefinition.java:31)
at
org.apache.camel.model.ProcessorDefinition.createProcessor(ProcessorDefinition.java:460)
at
org.apache.camel.model.ChoiceDefinition.createProcessor(ChoiceDefinition.java:135)
at
org.apache.camel.model.ProcessorDefinition.makeProcessor(ProcessorDefinition.java:500)
at
org.apache.camel.model.ProcessorDefinition.addRoutes(ProcessorDefinition.java:213)
at
org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:909)
... 11 more
Please give me feedback ASAP.
--
View this message in context: http://camel.465427.n5.nabble.com/Camel-resequencer-is-not-working-inside-choice-java-dsl-tp5766390.html
Sent from the Camel Development mailing list archive at Nabble.com.
Re: Camel resequencer() is not working inside choice - java dsl
Posted by Henryk Konsek <he...@gmail.com>.
Hi,
Regarding 1) - you don't have to know the endpoints upfront because you can
connect resequencer to the Recipient List using the direct endpoint. Just
as Willem demonstrated.
Cheers.
wt., 28.04.2015 o 06:38 użytkownik Sumit <su...@gmail.com>
napisał:
> Hi,
>
> Thanks for your quick reply.
>
> We have following concerns:
>
> 1. .to() will not fit in our case as we dont know the endpoint uris
> earlier.
> I determine the endpoints as java Set. So is there any workaround for this?
>
> 2. If we put the messages in another queue after resequencing and run the
> followinf code ---from(“direct:A”).recipientList(...) --- concurrently
> (mutiple threads) then will it maintain the same sequence.
>
> Your quick response is highly appreciated.
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Camel-resequencer-is-not-working-inside-choice-java-dsl-tp5766390p5766412.html
> Sent from the Camel Development mailing list archive at Nabble.com.
>
Re: Camel resequencer() is not working inside choice - java dsl
Posted by Sumit <su...@gmail.com>.
Hi,
Thanks for your quick reply.
We have following concerns:
1. .to() will not fit in our case as we dont know the endpoint uris earlier.
I determine the endpoints as java Set. So is there any workaround for this?
2. If we put the messages in another queue after resequencing and run the
followinf code ---from(“direct:A”).recipientList(...) --- concurrently
(mutiple threads) then will it maintain the same sequence.
Your quick response is highly appreciated.
--
View this message in context: http://camel.465427.n5.nabble.com/Camel-resequencer-is-not-working-inside-choice-java-dsl-tp5766390p5766412.html
Sent from the Camel Development mailing list archive at Nabble.com.
Re: Camel resequencer() is not working inside choice - java dsl
Posted by Willem Jiang <wi...@gmail.com>.
When you use the resequencer(), you need to specify the to endpoint.
The route can be changed to
from(...)
.choice()
.when(...)
.resequence(header(...)).stream().to(“direct:A”)
.endchoice()
.when(...)
.resequence(header(...)).stream().to(“direct:A”)
.endchoice()
.end()
from(“direct:A”).recipientList(...)
--
Willem Jiang
Red Hat, Inc.
Web: http://www.redhat.com
Blog: http://willemjiang.blogspot.com (English)
http://jnn.iteye.com (Chinese)
Twitter: willemjiang
Weibo: 姜宁willem
On April 27, 2015 at 11:41:44 PM, Sumit (summ.chakraborty@gmail.com) wrote:
> > Hi,
>
> I have applied the resequencer() function conditionally like
> the following
> example:
>
> from(...)
> .choice()
> .when(...)
> .resequence(header(...)).stream()
> .endchoice()
> .when(...)
> .resequence(header(...)).stream()
> .endchoice()
> .recipientList(...)
> .end()