You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by contactreji <co...@gmail.com> on 2014/10/21 10:38:43 UTC
Camel Splitter EIP
Hi friends
I am trying to split my messages using camel splitter. But its a slightly
different way of doing things.
I have an input file as follows
*<School>
<Department>ECONOMICS<Department>
<Students>
<Student>Paul</Student>
<Student>Thomas</Student>
</Students>
</School>
*
I want the output as follows
*<School>
<Department>ECONOMICS<Department>
<Students>
<Student>Paul</Student>
</Students>
</School>
*
And another record as
*<School>
<Department>ECONOMICS<Department>
<Students>
<Student>Paul</Student>
</Students>
</School>*
How can I acheive this with Camel out of box feature?
Basically , I have a case where some values in multiple line items might be
invalid and the target system rejects the whole lot of records due to one
bad record.
Hence i want to send records one by one.
Cheers
Reji
--
View this message in context: http://camel.465427.n5.nabble.com/Camel-Splitter-EIP-tp5757844.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Camel Splitter EIP
Posted by Charles Moulliard <ch...@gmail.com>.
xtokenize is only available since Apache Camel 2.14 as described in the
documentation.
On Tue, Oct 21, 2014 at 12:06 PM, contactreji <co...@gmail.com> wrote:
> Hi Charles
>
> I also found something called xtokenize on
> http://camel.apache.org/splitter.html documentation page.
>
> Can you suggest how this can be used to my use case?
>
> Reji
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Camel-Splitter-EIP-tp5757844p5757851.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
--
Charles Moulliard
Apache Committer / Architect @RedHat
Twitter : @cmoulliard | Blog : http://cmoulliard.github.io
Re: Camel Splitter EIP
Posted by contactreji <co...@gmail.com>.
Hi Charles
I also found something called xtokenize on
http://camel.apache.org/splitter.html documentation page.
Can you suggest how this can be used to my use case?
Reji
--
View this message in context: http://camel.465427.n5.nabble.com/Camel-Splitter-EIP-tp5757844p5757851.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Camel Splitter EIP
Posted by contactreji <co...@gmail.com>.
Thanks Charles
My camel xml file looks like
*
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:camel="http://camel.apache.org/schema/spring"
xmlns:jaxws="http://cxf.apache.org/jaxws"
xmlns:http-conf="http://cxf.apache.org/transports/http/configuration"
xmlns:http="http://cxf.apache.org/transports/http/configuration"
xmlns:ctx="http://www.springframework.org/schema/context"
xmlns:cxf="http://camel.apache.org/schema/cxf"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:osgi="http://www.springframework.org/schema/osgi"
xmlns:sec="http://cxf.apache.org/configuration/security"
xsi:schemaLocation="
http://cxf.apache.org/bindings/soap
http://cxf.apache.org/schemas/configuration/soap.xsd
http://camel.apache.org/schema/cxf
http://camel.apache.org/schema/cxf/camel-cxf.xsd
http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://camel.apache.org/schema/spring
http://camel.apache.org/schema/spring/camel-spring-2.10.7.xsd
http://cxf.apache.org/configuration/security
http://cxf.apache.org/schemas/configuration/security.xsd
http://cxf.apache.org/transports/http/configuration
http://cxf.apache.org/schemas/configuration/http-conf.xsd
http://cxf.apache.org/bindings/soap
http://cxf.apache.org/schemas/configuration/soap.xsd
http://www.springframework.org/schema/osgi
http://www.springframework.org/schema/osgi/spring-osgi.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd
">
<camelContext xmlns="http://camel.apache.org/schema/spring">
<route>
<from uri="file://C:/Users/re267981/Desktop/input" />
<split streaming="true">
<tokenize mode="w">ns:SyncPersonnel/ns:DataArea/ns:Personnel</tokenize>
<to uri="file://C:/Users/re267981/Desktop/output" />
</split>
</route>
</camelContext>
</beans>
*
It gives me a new set or errors as
*Caused by: org.xml.sax.SAXParseException; lineNumber: 29; columnNumber: 16;
cvc-complex-type.2.4.a: Invalid content was found starting with element
'camelContext'. One of
'{"http://www.springframework.org/schema/beans":description,
"http://www.springframework.org/schema/beans":import,
"http://www.springframework.org/schema/beans":alias,
"http://www.springframework.org/schema/beans":bean,
WC[##other:"http://www.springframework.org/schema/beans"]}' is expected.
at
com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:198)*
Can u suggest if there is some version mismatches to be checked? Is the mode
attribute really usable in camel 2.10.x versions?
--
View this message in context: http://camel.465427.n5.nabble.com/Camel-Splitter-EIP-tp5757844p5757850.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Camel Splitter EIP
Posted by Charles Moulliard <ch...@gmail.com>.
Hi,
The error reported tells you that you can't use the `mode` attribute within
the <tokenize/> tag. Here is the schema definition (
http://camel.apache.org/schema/spring/camel-spring-2.10.7.xsd). You will
simply your life if you use autocompletion for the XML within your IDE
studio (Eclipse, ...).
Regards,
On Tue, Oct 21, 2014 at 11:15 AM, contactreji <co...@gmail.com> wrote:
> Hi Charles
>
>
> Thanks for you input.
>
> I have change to token. But i get errors as
>
> *Caused by: org.xml.sax.SAXParseException; lineNumber: 50; columnNumber:
> 24;
> cvc-complex-type.3.2.2: Attribute 'mode' is not allowed to appear in
> element
> 'tokenize'.
> at
>
> com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:198)
> at
>
> com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:134)
> at
>
> com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:437)*
>
> Looks like xtokenise is available from Camel 2.14.
>
> I am using camel 2.10.xx version. Is there a way to achieve the use case
> with this version? or rather with <tokenize> ?
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Camel-Splitter-EIP-tp5757844p5757847.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
--
Charles Moulliard
Apache Committer / Architect @RedHat
Twitter : @cmoulliard | Blog : http://cmoulliard.github.io
Re: Camel Splitter EIP
Posted by contactreji <co...@gmail.com>.
Hi Charles
Thanks for you input.
I have change to token. But i get errors as
*Caused by: org.xml.sax.SAXParseException; lineNumber: 50; columnNumber: 24;
cvc-complex-type.3.2.2: Attribute 'mode' is not allowed to appear in element
'tokenize'.
at
com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:198)
at
com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:134)
at
com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:437)*
Looks like xtokenise is available from Camel 2.14.
I am using camel 2.10.xx version. Is there a way to achieve the use case
with this version? or rather with <tokenize> ?
--
View this message in context: http://camel.465427.n5.nabble.com/Camel-Splitter-EIP-tp5757844p5757847.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Camel Splitter EIP
Posted by Charles Moulliard <ch...@gmail.com>.
Hi,
The tag <xtokenize/> is not correct. Replace it with <tokenize/>
Regards,
On Tue, Oct 21, 2014 at 11:03 AM, contactreji <co...@gmail.com> wrote:
> I tried doing it this way
>
> <route>
> <from uri="file://C:/Users/re267981/Desktop/input"
> />
> <split streaming="true">
> <xtokenize
> mode="w">ns:SyncPersonnel/ns:DataArea/ns:Personnel</xtokenize>
> <to
> uri="file://C:/Users/re267981/Desktop/output" />
> </split>
>
> </route>
>
> Is this the correct way? I also get an error as
> *
> Caused by: org.xml.sax.SAXParseException; lineNumber: 33; columnNumber: 25;
> cvc-complex-type.2.4.a: Invalid content was found starting with element
> 'xtokenize'. 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":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":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":property,
> "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":tokenize,
> "http://camel.apache.org/schema/spring":xpath,
> "http://camel.apache.org/schema/spring":xquery}' is expected.
> at
>
> com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:198)*
>
>
> Do i need to add any namespace anywhere?
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Camel-Splitter-EIP-tp5757844p5757845.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
--
Charles Moulliard
Apache Committer / Architect @RedHat
Twitter : @cmoulliard | Blog : http://cmoulliard.github.io
Re: Camel Splitter EIP
Posted by contactreji <co...@gmail.com>.
I tried doing it this way
<route>
<from uri="file://C:/Users/re267981/Desktop/input" />
<split streaming="true">
<xtokenize
mode="w">ns:SyncPersonnel/ns:DataArea/ns:Personnel</xtokenize>
<to uri="file://C:/Users/re267981/Desktop/output" />
</split>
</route>
Is this the correct way? I also get an error as
*
Caused by: org.xml.sax.SAXParseException; lineNumber: 33; columnNumber: 25;
cvc-complex-type.2.4.a: Invalid content was found starting with element
'xtokenize'. 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":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":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":property,
"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":tokenize,
"http://camel.apache.org/schema/spring":xpath,
"http://camel.apache.org/schema/spring":xquery}' is expected.
at
com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:198)*
Do i need to add any namespace anywhere?
--
View this message in context: http://camel.465427.n5.nabble.com/Camel-Splitter-EIP-tp5757844p5757845.html
Sent from the Camel - Users mailing list archive at Nabble.com.