Hello,

Is it possible to combine fixedlength record with csvrecord in bindy using
two different models i.e. two different classes?

For example say you have the following input data:
09N20100930    09384820100930    093848AP|AOMAIN|AB111111|AC|

The first part "09N20100930    09384820100930    093848" are defined in 4
different fixed length fields. All are required.
The second part "AP|AOMAIN|AB111111|AC|" are all variable length and defined
using tags i.e. AP, AO, AB, AC and separator is "|". Some are required and
some are optional.

I have defined the fixed length fields in class based on
BindyFixedLengthFormat and the variable length fields in a CsvRecord class
and using @Link annotation to bind them together.

When I run the dsl I get:

java.lang.StringIndexOutOfBoundsException: String index out of range: -1
at java.lang.String.substring(String.java:1967)
        at
org.apache.camel.dataformat.bindy.BindyFixedLengthFactory.bind(BindyFixedLengthFactory.java:205)
        at
org.apache.camel.dataformat.bindy.fixed.BindyFixedLengthDataFormat.createModel(BindyFixedLengthDataFormat.java:257)
        at
org.apache.camel.dataformat.bindy.fixed.BindyFixedLengthDataFormat.unmarshal(BindyFixedLengthDataFormat.java:209)
        at
org.apache.camel.processor.UnmarshalProcessor.process(UnmarshalProcessor.java:69)
        at
org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:77)
        at
org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:460)
        at
org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:190)
        at org.apache.camel.processor.Pipeline.process(Pipeline.java:121)
        at org.apache.camel.processor.Pipeline.process(Pipeline.java:83)
        at
org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:190)
        at
org.apache.camel.component.file.GenericFileConsumer.processExchange(GenericFileConsumer.java:442)
        at
org.apache.camel.component.file.GenericFileConsumer.processBatch(GenericFileConsumer.java:214)
        at
org.apache.camel.component.file.GenericFileConsumer.poll(GenericFileConsumer.java:178)
        at
org.apache.camel.impl.ScheduledPollConsumer.doRun(ScheduledPollConsumer.java:174)
        at
org.apache.camel.impl.ScheduledPollConsumer.run(ScheduledPollConsumer.java:101)
        at 
java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
        at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)
        at
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)
        at
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)
        at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:745)

I suspect it cannot handle the mixing of the two formats?!

Best
Souciance



--
View this message in context: 
http://camel.465427.n5.nabble.com/Bindy-mixing-fixedlength-and-csvRecord-tp5776656.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to