You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@camel.apache.org by Onder SEZGIN <on...@apache.org> on 2018/06/13 18:36:35 UTC

[heads-up] Re: camel-spring.xsd gets updated and new tag fails during start up

Hi Guys,

Just a heads up.
I found problems with the implementation so before moving ahead with XML
DSL i reverted the changes.
I will try to revisit.
Four you information.

Thanks.

On Tue, Jun 12, 2018 at 9:53 AM Onder SEZGIN <on...@apache.org> wrote:

> Thanks Guys,
>
> @ Alex, I suspect the schema is wrong but as you and Willem mentioned jaxb
> annotation definition may matter.
>
> @ Willem, i thought not putting required="true" makes it optional, maybe
> making it optional as you mentioned and what i presumably did changes the
> output of autogenerated xsd file and then it affects the xml dsl.
>
> I will try to go into deep.
>
>
> On Tue, Jun 12, 2018 at 6:57 AM Willem Jiang <wi...@gmail.com>
> wrote:
>
>> I just have a quick look at the code, the schema is updated, but there are
>> something wrong with the xml file.
>> As the ThrottleDefinition is extends from ExpressionNode, but the first
>> element of ExpressionNode is a reference of expression element, not
>> the correlationExpression
>> that you want.
>> So you keep getting the complain message.
>>
>> Once I put the correlationExpression as the last element of throttle, I
>> don't get the error message anymore. (but the test is freeze ).
>>
>> <route errorHandlerRef="dlc">
>>   <from uri="seda:b"/>
>>   <throttle timePeriodMillis="1000">
>>     <header>max</header>
>>     <to uri="log:result"/>
>>     <to uri="mock:result"/>
>>     <correlationExpression>
>>       <constant>2</constant>
>>     </correlationExpression>
>>   </throttle>
>> </route>
>>
>> We need to address the element order first to fix this issue.
>>
>> BTW, I also find an issue in the ThrottleDefinition, to support to old XML
>> which has no correlationExpression, we need to specify the element as an
>> optional one.
>> Just like this :
>>
>> @XmlElements({
>>     @XmlElement(name = "correlationExpression", type =
>> ExpressionSubElementDefinition.class)}
>> )
>> private ExpressionSubElementDefinition correlationExpression;
>>
>>
>>
>>
>> Willem Jiang
>>
>> Twitter: willemjiang
>> Weibo: 姜宁willem
>>
>> On Tue, Jun 12, 2018 at 5:23 AM, Alex Dettinger <al...@gmail.com>
>> wrote:
>>
>> > Hi,
>> >
>> >   I had a quick look and forced the resolution of the schema like this:
>> > http://camel.apache.org/schema/spring
>> > /home/aldettinger/.m2/repository/org/apache/camel/
>> > camel-spring/2.22.0-SNAPSHOT/camel-spring-2.22.0-SNAPSHOT.xsd
>> >
>> >   And hit the same issue then you. So I think that the last version of
>> the
>> > schema is loaded, but the schema would be wrong then.
>> >
>> > Hope this help,
>> > Alex
>> >
>> > On Mon, Jun 11, 2018 at 5:12 PM, Onder SEZGIN <on...@gmail.com>
>> > wrote:
>> >
>> > > Hi,
>> > >
>> > > please see the branch in this link.
>> > > https://github.com/apache/camel/pull/2366#issuecomment-396193135
>> > >
>> > > or this one.
>> > >
>> > >
>> https://github.com/onderson/camel/commit/ae63d64f627ec921c574059aadd1cf
>> > > 894f5f3e2e
>> > >
>> > >
>> > > On Mon, Jun 11, 2018 at 5:32 PM Willem Jiang <wi...@gmail.com>
>> > > wrote:
>> > >
>> > > > Where is your unit test?
>> > > > Can you check if you are using the latest built camel-spring jar.
>> > > > There is a schema definition in the camel-spring[1],  please make
>> sure
>> > > the
>> > > > new generated camel-spring.xsd is wrap into the camel-spring.jar
>> > > >
>> > > > [1]
>> > > >
>> > > > https://github.com/apache/camel/blob/master/components/
>> > > camel-spring/src/main/resources/META-INF/spring.schemas
>> > > >
>> > > >
>> > > > Willem Jiang
>> > > >
>> > > > Twitter: willemjiang
>> > > > Weibo: 姜宁willem
>> > > >
>> > > > On Mon, Jun 11, 2018 at 9:11 PM, Onder SEZGIN <on...@apache.org>
>> > wrote:
>> > > >
>> > > > > i did try full build. it did not help in my case :/
>> > > > >
>> > > > > On Mon, Jun 11, 2018 at 12:23 PM Onder SEZGIN <
>> ondersezgin@gmail.com
>> > >
>> > > > > wrote:
>> > > > >
>> > > > > > no. because it may take very long on my pc.
>> > > > > > I will try to check.
>> > > > > >
>> > > > > > On Mon, Jun 11, 2018 at 12:17 PM Andrea Cosentino
>> > > > > > <an...@yahoo.com.invalid> wrote:
>> > > > > >
>> > > > > >> Did you try a full rebuild?
>> > > > > >>
>> > > > > >> --
>> > > > > >> Andrea Cosentino
>> > > > > >> ----------------------------------
>> > > > > >> Apache Camel PMC Chair
>> > > > > >> Apache Karaf Committer
>> > > > > >> Apache Servicemix PMC Member
>> > > > > >> Email: ancosen1985@yahoo.com
>> > > > > >> Twitter: @oscerd2
>> > > > > >> Github: oscerd
>> > > > > >>
>> > > > > >>
>> > > > > >>
>> > > > > >>
>> > > > > >>
>> > > > > >>
>> > > > > >> On Monday, June 11, 2018, 11:15:17 AM GMT+2, Onder SEZGIN <
>> > > > > >> onders@apache.org> wrote:
>> > > > > >>
>> > > > > >>
>> > > > > >>
>> > > > > >>
>> > > > > >>
>> > > > > >> Hi Guys,
>> > > > > >>
>> > > > > >> I've recently implemented CAMEL-6840 and new xml element is
>> > > introduced
>> > > > > as
>> > > > > >> a
>> > > > > >> result of it.
>> > > > > >> I am trying to create a unit test for it under camel-spring to
>> see
>> > > if
>> > > > > the
>> > > > > >> new element is fine in XML DSL.
>> > > > > >> and i have this simple xml route.
>> > > > > >>
>> > > > > >>   <camelContext xmlns="http://camel.apache.org/schema/spring">
>> > > > > >>     <errorHandler id="dlc" deadLetterUri="mock:dead"
>> > > > > >> type="DeadLetterChannel"/>
>> > > > > >>     <route errorHandlerRef="dlc">
>> > > > > >>       <from uri="seda:a"/>
>> > > > > >>       <throttle timePeriodMillis="1000">
>> > > > > >>         <correlationExpression>
>> > > > > >>           <constant>1</constant>
>> > > > > >>         </correlationExpression>
>> > > > > >>         <header>max</header>
>> > > > > >>         <to uri="log:result"/>
>> > > > > >>         <to uri="mock:result"/>
>> > > > > >>       </throttle>
>> > > > > >>     </route>
>> > > > > >>
>> > > > > >> Even though the build of camel-spring is ok and i can see right
>> > > > > >> definitions
>> > > > > >> in camel-spring.xsd, i can not run the unit test because of an
>> > error
>> > > > as
>> > > > > >> below.
>> > > > > >>
>> > > > > >> My guess is somewhat unit test can not recognize
>> camel-spring.xsd
>> > > but
>> > > > > not
>> > > > > >> sure.
>> > > > > >> Any idea?
>> > > > > >>
>> > > > > >> Caused by: org.xml.sax.SAXParseException; lineNumber: 34;
>> > > > columnNumber:
>> > > > > >> 32;
>> > > > > >> cvc-complex-type.2.4.a: Invalid content was found starting with
>> > > > element
>> > > > > >> 'correlationExpression'. One of
>> > > > > >> '{"http://camel.apache.org/schema/spring":description,
>> > > > > >> "http://camel.apache.org/schema/spring":expressionDefinition,
>> "
>> > > > > >> http://camel.apache.org/schema/spring":constant, "
>> > > > > >> http://camel.apache.org/schema/spring":el, "
>> > > > > >> http://camel.apache.org/schema/spring":exchangeProperty, "
>> > > > > >> http://camel.apache.org/schema/spring":groovy, "
>> > > > > >> http://camel.apache.org/schema/spring":header, "
>> > > > > >> http://camel.apache.org/schema/spring":jxpath, "
>> > > > > >> http://camel.apache.org/schema/spring":javaScript, "
>> > > > > >> http://camel.apache.org/schema/spring":jsonpath, "
>> > > > > >> http://camel.apache.org/schema/spring":language, "
>> > > > > >> http://camel.apache.org/schema/spring":method, "
>> > > > > >> http://camel.apache.org/schema/spring":mvel, "
>> > > > > >> http://camel.apache.org/schema/spring":ognl, "
>> > > > > >> http://camel.apache.org/schema/spring":php, "
>> > > > > >> http://camel.apache.org/schema/spring":python, "
>> > > > > >> http://camel.apache.org/schema/spring":ref, "
>> > > > > >> http://camel.apache.org/schema/spring":ruby, "
>> > > > > >> http://camel.apache.org/schema/spring":simple, "
>> > > > > >> http://camel.apache.org/schema/spring":spel, "
>> > > > > >> http://camel.apache.org/schema/spring":sql, "
>> > > > > >> http://camel.apache.org/schema/spring":terser, "
>> > > > > >> http://camel.apache.org/schema/spring":tokenize, "
>> > > > > >> http://camel.apache.org/schema/spring":xtokenize, "
>> > > > > >> http://camel.apache.org/schema/spring":xpath, "
>> > > > > >> http://camel.apache.org/schema/spring":xquery}' is expected.
>> > > > > >>
>> > > > > >
>> > > > >
>> > > >
>> > >
>> >
>>
>

Re: [heads-up] Re: camel-spring.xsd gets updated and new tag fails during start up

Posted by Onder SEZGIN <on...@apache.org>.
Hi,
Sure no problem.
As there was no grouping of Delay queues and there was only one single
DelayQueue in Throttler implementation.
My initial thought was simple to group them in ConcurrentHashMap or
LRUCache according to the expression provided in an expression with this
way.

from("myendpoint")
.throttle(groupIdExpression, maxRequestPerPeriodExpression)
....

GroupId expression is what i called correlationExpression which has similar
naming aggregate pattern. (You know naming is hard.)

So afterwards, in the implementation i replaced single queue with Map of
Queues to retreieve from or place the items in it considering the grouping
expression.

(PS: In the code i checked and i found a problem that the order of
parameters are placed wrongly in ProcessorDefinition[1][2] to create an
instance of ThrottlerDefinition. This was making single
correlationExpression  which works ok as already(before reverting) in unit
tests but after i reliazed and fixed that problem to provide right order
and correlationExpression started to be varing in values as intented and
unit tests failed and then i realised there was an initial design mistake i
was caught up.. Thanks to unit testing :) )

So as i mentioned in the side note, if we have map of delay queues and if
that map has only one delay queue, we don't know the result of what i have
done.
if correlationExpresssion varies then the problem arises, and there was
another mistake, i did, which was to see throttleRate[3] was single
volatile member of Throttler and dependent on Delay Queue. And i also need
to make it as map. (which was not existing in implementation i checked-in.
So as you can guess, at some point after realizing what i have done, i felt
like what i checked-in was rubbish so i reverted to rethink on it.)

So let's say i did make throttleRate into throttleRatesMap to save
DelayQueue's rates(for now we can assume all delay queues throttleRate is
the same as we don't have such throttleRatesMap), there is another issue
which is the initialization of delay queue. (in my case it will be queues
becuase you know i was thinking of having group of queues stored in map)

Originally Queues are initialized with permits depending on the initial
throttle rate. This is not an issue if you have a single queue. but if you
want to have multiple queues stored and grouped in a map (as i tried to
do), considering the existing implementation approach all the queues needs
to initialised in the same way. However, it is not very hard to do so
throttleRatesMap will serve for that. (I had figured it out while writing..)

I will open the PR soon so you can review.
Any feedback is welcome.

[1]
https://github.com/onderson/camel/blob/CAMEL-6840/camel-core/src/main/java/org/apache/camel/model/ProcessorDefinition.java#L2304
[2]
https://github.com/onderson/camel/blob/CAMEL-6840/camel-core/src/main/java/org/apache/camel/model/ProcessorDefinition.java#L2325
[3]
https://github.com/onderson/camel/blob/CAMEL-6840/camel-core/src/main/java/org/apache/camel/processor/Throttler.java#L83


On Thu, Jun 14, 2018 at 1:51 AM Willem Jiang <wi...@gmail.com> wrote:

> Hi Onder,
>
> Can you share more detail information of the problem that you found?
> Maybe we can help you review the design at the first place :)
>
>
> Willem Jiang
>
> Twitter: willemjiang
> Weibo: 姜宁willem
>
> On Thu, Jun 14, 2018 at 2:36 AM, Onder SEZGIN <on...@apache.org> wrote:
>
> > Hi Guys,
> >
> > Just a heads up.
> > I found problems with the implementation so before moving ahead with XML
> > DSL i reverted the changes.
> > I will try to revisit.
> > Four you information.
> >
> > Thanks.
> >
> > On Tue, Jun 12, 2018 at 9:53 AM Onder SEZGIN <on...@apache.org> wrote:
> >
> > > Thanks Guys,
> > >
> > > @ Alex, I suspect the schema is wrong but as you and Willem mentioned
> > jaxb
> > > annotation definition may matter.
> > >
> > > @ Willem, i thought not putting required="true" makes it optional,
> maybe
> > > making it optional as you mentioned and what i presumably did changes
> the
> > > output of autogenerated xsd file and then it affects the xml dsl.
> > >
> > > I will try to go into deep.
> > >
> > >
> > > On Tue, Jun 12, 2018 at 6:57 AM Willem Jiang <wi...@gmail.com>
> > > wrote:
> > >
> > >> I just have a quick look at the code, the schema is updated, but there
> > are
> > >> something wrong with the xml file.
> > >> As the ThrottleDefinition is extends from ExpressionNode, but the
> first
> > >> element of ExpressionNode is a reference of expression element, not
> > >> the correlationExpression
> > >> that you want.
> > >> So you keep getting the complain message.
> > >>
> > >> Once I put the correlationExpression as the last element of throttle,
> I
> > >> don't get the error message anymore. (but the test is freeze ).
> > >>
> > >> <route errorHandlerRef="dlc">
> > >>   <from uri="seda:b"/>
> > >>   <throttle timePeriodMillis="1000">
> > >>     <header>max</header>
> > >>     <to uri="log:result"/>
> > >>     <to uri="mock:result"/>
> > >>     <correlationExpression>
> > >>       <constant>2</constant>
> > >>     </correlationExpression>
> > >>   </throttle>
> > >> </route>
> > >>
> > >> We need to address the element order first to fix this issue.
> > >>
> > >> BTW, I also find an issue in the ThrottleDefinition, to support to old
> > XML
> > >> which has no correlationExpression, we need to specify the element as
> an
> > >> optional one.
> > >> Just like this :
> > >>
> > >> @XmlElements({
> > >>     @XmlElement(name = "correlationExpression", type =
> > >> ExpressionSubElementDefinition.class)}
> > >> )
> > >> private ExpressionSubElementDefinition correlationExpression;
> > >>
> > >>
> > >>
> > >>
> > >> Willem Jiang
> > >>
> > >> Twitter: willemjiang
> > >> Weibo: 姜宁willem
> > >>
> > >> On Tue, Jun 12, 2018 at 5:23 AM, Alex Dettinger <
> aldettinger@gmail.com>
> > >> wrote:
> > >>
> > >> > Hi,
> > >> >
> > >> >   I had a quick look and forced the resolution of the schema like
> > this:
> > >> > http://camel.apache.org/schema/spring
> > >> > /home/aldettinger/.m2/repository/org/apache/camel/
> > >> > camel-spring/2.22.0-SNAPSHOT/camel-spring-2.22.0-SNAPSHOT.xsd
> > >> >
> > >> >   And hit the same issue then you. So I think that the last version
> of
> > >> the
> > >> > schema is loaded, but the schema would be wrong then.
> > >> >
> > >> > Hope this help,
> > >> > Alex
> > >> >
> > >> > On Mon, Jun 11, 2018 at 5:12 PM, Onder SEZGIN <
> ondersezgin@gmail.com>
> > >> > wrote:
> > >> >
> > >> > > Hi,
> > >> > >
> > >> > > please see the branch in this link.
> > >> > > https://github.com/apache/camel/pull/2366#issuecomment-396193135
> > >> > >
> > >> > > or this one.
> > >> > >
> > >> > >
> > >>
> https://github.com/onderson/camel/commit/ae63d64f627ec921c574059aadd1cf
> > >> > > 894f5f3e2e
> > >> > >
> > >> > >
> > >> > > On Mon, Jun 11, 2018 at 5:32 PM Willem Jiang <
> > willem.jiang@gmail.com>
> > >> > > wrote:
> > >> > >
> > >> > > > Where is your unit test?
> > >> > > > Can you check if you are using the latest built camel-spring
> jar.
> > >> > > > There is a schema definition in the camel-spring[1],  please
> make
> > >> sure
> > >> > > the
> > >> > > > new generated camel-spring.xsd is wrap into the camel-spring.jar
> > >> > > >
> > >> > > > [1]
> > >> > > >
> > >> > > > https://github.com/apache/camel/blob/master/components/
> > >> > > camel-spring/src/main/resources/META-INF/spring.schemas
> > >> > > >
> > >> > > >
> > >> > > > Willem Jiang
> > >> > > >
> > >> > > > Twitter: willemjiang
> > >> > > > Weibo: 姜宁willem
> > >> > > >
> > >> > > > On Mon, Jun 11, 2018 at 9:11 PM, Onder SEZGIN <
> onders@apache.org>
> > >> > wrote:
> > >> > > >
> > >> > > > > i did try full build. it did not help in my case :/
> > >> > > > >
> > >> > > > > On Mon, Jun 11, 2018 at 12:23 PM Onder SEZGIN <
> > >> ondersezgin@gmail.com
> > >> > >
> > >> > > > > wrote:
> > >> > > > >
> > >> > > > > > no. because it may take very long on my pc.
> > >> > > > > > I will try to check.
> > >> > > > > >
> > >> > > > > > On Mon, Jun 11, 2018 at 12:17 PM Andrea Cosentino
> > >> > > > > > <an...@yahoo.com.invalid> wrote:
> > >> > > > > >
> > >> > > > > >> Did you try a full rebuild?
> > >> > > > > >>
> > >> > > > > >> --
> > >> > > > > >> Andrea Cosentino
> > >> > > > > >> ----------------------------------
> > >> > > > > >> Apache Camel PMC Chair
> > >> > > > > >> Apache Karaf Committer
> > >> > > > > >> Apache Servicemix PMC Member
> > >> > > > > >> Email: ancosen1985@yahoo.com
> > >> > > > > >> Twitter: @oscerd2
> > >> > > > > >> Github: oscerd
> > >> > > > > >>
> > >> > > > > >>
> > >> > > > > >>
> > >> > > > > >>
> > >> > > > > >>
> > >> > > > > >>
> > >> > > > > >> On Monday, June 11, 2018, 11:15:17 AM GMT+2, Onder SEZGIN <
> > >> > > > > >> onders@apache.org> wrote:
> > >> > > > > >>
> > >> > > > > >>
> > >> > > > > >>
> > >> > > > > >>
> > >> > > > > >>
> > >> > > > > >> Hi Guys,
> > >> > > > > >>
> > >> > > > > >> I've recently implemented CAMEL-6840 and new xml element is
> > >> > > introduced
> > >> > > > > as
> > >> > > > > >> a
> > >> > > > > >> result of it.
> > >> > > > > >> I am trying to create a unit test for it under camel-spring
> > to
> > >> see
> > >> > > if
> > >> > > > > the
> > >> > > > > >> new element is fine in XML DSL.
> > >> > > > > >> and i have this simple xml route.
> > >> > > > > >>
> > >> > > > > >>   <camelContext xmlns="
> http://camel.apache.org/schema/spring
> > ">
> > >> > > > > >>     <errorHandler id="dlc" deadLetterUri="mock:dead"
> > >> > > > > >> type="DeadLetterChannel"/>
> > >> > > > > >>     <route errorHandlerRef="dlc">
> > >> > > > > >>       <from uri="seda:a"/>
> > >> > > > > >>       <throttle timePeriodMillis="1000">
> > >> > > > > >>         <correlationExpression>
> > >> > > > > >>           <constant>1</constant>
> > >> > > > > >>         </correlationExpression>
> > >> > > > > >>         <header>max</header>
> > >> > > > > >>         <to uri="log:result"/>
> > >> > > > > >>         <to uri="mock:result"/>
> > >> > > > > >>       </throttle>
> > >> > > > > >>     </route>
> > >> > > > > >>
> > >> > > > > >> Even though the build of camel-spring is ok and i can see
> > right
> > >> > > > > >> definitions
> > >> > > > > >> in camel-spring.xsd, i can not run the unit test because of
> > an
> > >> > error
> > >> > > > as
> > >> > > > > >> below.
> > >> > > > > >>
> > >> > > > > >> My guess is somewhat unit test can not recognize
> > >> camel-spring.xsd
> > >> > > but
> > >> > > > > not
> > >> > > > > >> sure.
> > >> > > > > >> Any idea?
> > >> > > > > >>
> > >> > > > > >> Caused by: org.xml.sax.SAXParseException; lineNumber: 34;
> > >> > > > columnNumber:
> > >> > > > > >> 32;
> > >> > > > > >> cvc-complex-type.2.4.a: Invalid content was found starting
> > with
> > >> > > > element
> > >> > > > > >> 'correlationExpression'. One of
> > >> > > > > >> '{"http://camel.apache.org/schema/spring":description,
> > >> > > > > >> "http://camel.apache.org/schema/spring":
> > expressionDefinition,
> > >> "
> > >> > > > > >> http://camel.apache.org/schema/spring":constant, "
> > >> > > > > >> http://camel.apache.org/schema/spring":el, "
> > >> > > > > >> http://camel.apache.org/schema/spring":exchangeProperty, "
> > >> > > > > >> http://camel.apache.org/schema/spring":groovy, "
> > >> > > > > >> http://camel.apache.org/schema/spring":header, "
> > >> > > > > >> http://camel.apache.org/schema/spring":jxpath, "
> > >> > > > > >> http://camel.apache.org/schema/spring":javaScript, "
> > >> > > > > >> http://camel.apache.org/schema/spring":jsonpath, "
> > >> > > > > >> http://camel.apache.org/schema/spring":language, "
> > >> > > > > >> http://camel.apache.org/schema/spring":method, "
> > >> > > > > >> http://camel.apache.org/schema/spring":mvel, "
> > >> > > > > >> http://camel.apache.org/schema/spring":ognl, "
> > >> > > > > >> http://camel.apache.org/schema/spring":php, "
> > >> > > > > >> http://camel.apache.org/schema/spring":python, "
> > >> > > > > >> http://camel.apache.org/schema/spring":ref, "
> > >> > > > > >> http://camel.apache.org/schema/spring":ruby, "
> > >> > > > > >> http://camel.apache.org/schema/spring":simple, "
> > >> > > > > >> http://camel.apache.org/schema/spring":spel, "
> > >> > > > > >> http://camel.apache.org/schema/spring":sql, "
> > >> > > > > >> http://camel.apache.org/schema/spring":terser, "
> > >> > > > > >> http://camel.apache.org/schema/spring":tokenize, "
> > >> > > > > >> http://camel.apache.org/schema/spring":xtokenize, "
> > >> > > > > >> http://camel.apache.org/schema/spring":xpath, "
> > >> > > > > >> http://camel.apache.org/schema/spring":xquery}' is
> expected.
> > >> > > > > >>
> > >> > > > > >
> > >> > > > >
> > >> > > >
> > >> > >
> > >> >
> > >>
> > >
> >
>

Re: [heads-up] Re: camel-spring.xsd gets updated and new tag fails during start up

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

Can you share more detail information of the problem that you found?
Maybe we can help you review the design at the first place :)


Willem Jiang

Twitter: willemjiang
Weibo: 姜宁willem

On Thu, Jun 14, 2018 at 2:36 AM, Onder SEZGIN <on...@apache.org> wrote:

> Hi Guys,
>
> Just a heads up.
> I found problems with the implementation so before moving ahead with XML
> DSL i reverted the changes.
> I will try to revisit.
> Four you information.
>
> Thanks.
>
> On Tue, Jun 12, 2018 at 9:53 AM Onder SEZGIN <on...@apache.org> wrote:
>
> > Thanks Guys,
> >
> > @ Alex, I suspect the schema is wrong but as you and Willem mentioned
> jaxb
> > annotation definition may matter.
> >
> > @ Willem, i thought not putting required="true" makes it optional, maybe
> > making it optional as you mentioned and what i presumably did changes the
> > output of autogenerated xsd file and then it affects the xml dsl.
> >
> > I will try to go into deep.
> >
> >
> > On Tue, Jun 12, 2018 at 6:57 AM Willem Jiang <wi...@gmail.com>
> > wrote:
> >
> >> I just have a quick look at the code, the schema is updated, but there
> are
> >> something wrong with the xml file.
> >> As the ThrottleDefinition is extends from ExpressionNode, but the first
> >> element of ExpressionNode is a reference of expression element, not
> >> the correlationExpression
> >> that you want.
> >> So you keep getting the complain message.
> >>
> >> Once I put the correlationExpression as the last element of throttle, I
> >> don't get the error message anymore. (but the test is freeze ).
> >>
> >> <route errorHandlerRef="dlc">
> >>   <from uri="seda:b"/>
> >>   <throttle timePeriodMillis="1000">
> >>     <header>max</header>
> >>     <to uri="log:result"/>
> >>     <to uri="mock:result"/>
> >>     <correlationExpression>
> >>       <constant>2</constant>
> >>     </correlationExpression>
> >>   </throttle>
> >> </route>
> >>
> >> We need to address the element order first to fix this issue.
> >>
> >> BTW, I also find an issue in the ThrottleDefinition, to support to old
> XML
> >> which has no correlationExpression, we need to specify the element as an
> >> optional one.
> >> Just like this :
> >>
> >> @XmlElements({
> >>     @XmlElement(name = "correlationExpression", type =
> >> ExpressionSubElementDefinition.class)}
> >> )
> >> private ExpressionSubElementDefinition correlationExpression;
> >>
> >>
> >>
> >>
> >> Willem Jiang
> >>
> >> Twitter: willemjiang
> >> Weibo: 姜宁willem
> >>
> >> On Tue, Jun 12, 2018 at 5:23 AM, Alex Dettinger <al...@gmail.com>
> >> wrote:
> >>
> >> > Hi,
> >> >
> >> >   I had a quick look and forced the resolution of the schema like
> this:
> >> > http://camel.apache.org/schema/spring
> >> > /home/aldettinger/.m2/repository/org/apache/camel/
> >> > camel-spring/2.22.0-SNAPSHOT/camel-spring-2.22.0-SNAPSHOT.xsd
> >> >
> >> >   And hit the same issue then you. So I think that the last version of
> >> the
> >> > schema is loaded, but the schema would be wrong then.
> >> >
> >> > Hope this help,
> >> > Alex
> >> >
> >> > On Mon, Jun 11, 2018 at 5:12 PM, Onder SEZGIN <on...@gmail.com>
> >> > wrote:
> >> >
> >> > > Hi,
> >> > >
> >> > > please see the branch in this link.
> >> > > https://github.com/apache/camel/pull/2366#issuecomment-396193135
> >> > >
> >> > > or this one.
> >> > >
> >> > >
> >> https://github.com/onderson/camel/commit/ae63d64f627ec921c574059aadd1cf
> >> > > 894f5f3e2e
> >> > >
> >> > >
> >> > > On Mon, Jun 11, 2018 at 5:32 PM Willem Jiang <
> willem.jiang@gmail.com>
> >> > > wrote:
> >> > >
> >> > > > Where is your unit test?
> >> > > > Can you check if you are using the latest built camel-spring jar.
> >> > > > There is a schema definition in the camel-spring[1],  please make
> >> sure
> >> > > the
> >> > > > new generated camel-spring.xsd is wrap into the camel-spring.jar
> >> > > >
> >> > > > [1]
> >> > > >
> >> > > > https://github.com/apache/camel/blob/master/components/
> >> > > camel-spring/src/main/resources/META-INF/spring.schemas
> >> > > >
> >> > > >
> >> > > > Willem Jiang
> >> > > >
> >> > > > Twitter: willemjiang
> >> > > > Weibo: 姜宁willem
> >> > > >
> >> > > > On Mon, Jun 11, 2018 at 9:11 PM, Onder SEZGIN <on...@apache.org>
> >> > wrote:
> >> > > >
> >> > > > > i did try full build. it did not help in my case :/
> >> > > > >
> >> > > > > On Mon, Jun 11, 2018 at 12:23 PM Onder SEZGIN <
> >> ondersezgin@gmail.com
> >> > >
> >> > > > > wrote:
> >> > > > >
> >> > > > > > no. because it may take very long on my pc.
> >> > > > > > I will try to check.
> >> > > > > >
> >> > > > > > On Mon, Jun 11, 2018 at 12:17 PM Andrea Cosentino
> >> > > > > > <an...@yahoo.com.invalid> wrote:
> >> > > > > >
> >> > > > > >> Did you try a full rebuild?
> >> > > > > >>
> >> > > > > >> --
> >> > > > > >> Andrea Cosentino
> >> > > > > >> ----------------------------------
> >> > > > > >> Apache Camel PMC Chair
> >> > > > > >> Apache Karaf Committer
> >> > > > > >> Apache Servicemix PMC Member
> >> > > > > >> Email: ancosen1985@yahoo.com
> >> > > > > >> Twitter: @oscerd2
> >> > > > > >> Github: oscerd
> >> > > > > >>
> >> > > > > >>
> >> > > > > >>
> >> > > > > >>
> >> > > > > >>
> >> > > > > >>
> >> > > > > >> On Monday, June 11, 2018, 11:15:17 AM GMT+2, Onder SEZGIN <
> >> > > > > >> onders@apache.org> wrote:
> >> > > > > >>
> >> > > > > >>
> >> > > > > >>
> >> > > > > >>
> >> > > > > >>
> >> > > > > >> Hi Guys,
> >> > > > > >>
> >> > > > > >> I've recently implemented CAMEL-6840 and new xml element is
> >> > > introduced
> >> > > > > as
> >> > > > > >> a
> >> > > > > >> result of it.
> >> > > > > >> I am trying to create a unit test for it under camel-spring
> to
> >> see
> >> > > if
> >> > > > > the
> >> > > > > >> new element is fine in XML DSL.
> >> > > > > >> and i have this simple xml route.
> >> > > > > >>
> >> > > > > >>   <camelContext xmlns="http://camel.apache.org/schema/spring
> ">
> >> > > > > >>     <errorHandler id="dlc" deadLetterUri="mock:dead"
> >> > > > > >> type="DeadLetterChannel"/>
> >> > > > > >>     <route errorHandlerRef="dlc">
> >> > > > > >>       <from uri="seda:a"/>
> >> > > > > >>       <throttle timePeriodMillis="1000">
> >> > > > > >>         <correlationExpression>
> >> > > > > >>           <constant>1</constant>
> >> > > > > >>         </correlationExpression>
> >> > > > > >>         <header>max</header>
> >> > > > > >>         <to uri="log:result"/>
> >> > > > > >>         <to uri="mock:result"/>
> >> > > > > >>       </throttle>
> >> > > > > >>     </route>
> >> > > > > >>
> >> > > > > >> Even though the build of camel-spring is ok and i can see
> right
> >> > > > > >> definitions
> >> > > > > >> in camel-spring.xsd, i can not run the unit test because of
> an
> >> > error
> >> > > > as
> >> > > > > >> below.
> >> > > > > >>
> >> > > > > >> My guess is somewhat unit test can not recognize
> >> camel-spring.xsd
> >> > > but
> >> > > > > not
> >> > > > > >> sure.
> >> > > > > >> Any idea?
> >> > > > > >>
> >> > > > > >> Caused by: org.xml.sax.SAXParseException; lineNumber: 34;
> >> > > > columnNumber:
> >> > > > > >> 32;
> >> > > > > >> cvc-complex-type.2.4.a: Invalid content was found starting
> with
> >> > > > element
> >> > > > > >> 'correlationExpression'. One of
> >> > > > > >> '{"http://camel.apache.org/schema/spring":description,
> >> > > > > >> "http://camel.apache.org/schema/spring":
> expressionDefinition,
> >> "
> >> > > > > >> http://camel.apache.org/schema/spring":constant, "
> >> > > > > >> http://camel.apache.org/schema/spring":el, "
> >> > > > > >> http://camel.apache.org/schema/spring":exchangeProperty, "
> >> > > > > >> http://camel.apache.org/schema/spring":groovy, "
> >> > > > > >> http://camel.apache.org/schema/spring":header, "
> >> > > > > >> http://camel.apache.org/schema/spring":jxpath, "
> >> > > > > >> http://camel.apache.org/schema/spring":javaScript, "
> >> > > > > >> http://camel.apache.org/schema/spring":jsonpath, "
> >> > > > > >> http://camel.apache.org/schema/spring":language, "
> >> > > > > >> http://camel.apache.org/schema/spring":method, "
> >> > > > > >> http://camel.apache.org/schema/spring":mvel, "
> >> > > > > >> http://camel.apache.org/schema/spring":ognl, "
> >> > > > > >> http://camel.apache.org/schema/spring":php, "
> >> > > > > >> http://camel.apache.org/schema/spring":python, "
> >> > > > > >> http://camel.apache.org/schema/spring":ref, "
> >> > > > > >> http://camel.apache.org/schema/spring":ruby, "
> >> > > > > >> http://camel.apache.org/schema/spring":simple, "
> >> > > > > >> http://camel.apache.org/schema/spring":spel, "
> >> > > > > >> http://camel.apache.org/schema/spring":sql, "
> >> > > > > >> http://camel.apache.org/schema/spring":terser, "
> >> > > > > >> http://camel.apache.org/schema/spring":tokenize, "
> >> > > > > >> http://camel.apache.org/schema/spring":xtokenize, "
> >> > > > > >> http://camel.apache.org/schema/spring":xpath, "
> >> > > > > >> http://camel.apache.org/schema/spring":xquery}' is expected.
> >> > > > > >>
> >> > > > > >
> >> > > > >
> >> > > >
> >> > >
> >> >
> >>
> >
>