You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Brad Johnson <br...@mediadriver.com> on 2016/09/01 18:03:38 UTC

Re: Camel BeanIODataFormat Configure ErrorHandler for BeanIO Reader

If that works then great.  If you want to reject the file you'll likely
have to run the file twice.  The first for validation and the second for
processing.  Remember if you're streaming these and processing them and
then get a bad record like the one with the missing field, you've already
processed a good number of records and won't be able to reject the file.
Either that or you'll have to get into some sort of transaction and
rollback.

Brad

On Wed, Aug 31, 2016 at 1:50 PM, spurcell <sc...@mastercard.com>
wrote:

> Hello Brad,
>
> Here is an expected file (simplified down for discussion)
> "FHDR","1","t","20160"
> "LFHDR","p","4","2016"
> "TRNSFRREQ","p","2","A","4","U","a"
> "LFTRLR","p","1","4"
> "FTRLR","5","4"
>
>
> When a user sends in a bad file (2 FHDR files) I want to reject the file.
> "FHDR","1","t","20160"
> "FHDR","1","t","20160"
> "LFHDR","p","4","2016"
> "TRNSFRREQ","p","2","A","4","U","a"
> "LFTRLR","p","1","4"
> "FTRLR","5","4"
>
> If a user sends in a record with a missing field (LFHDR missing the "4"
> column) I would like to capture that in the reader and reject the file.
>
> "FHDR","1","t","20160"
> "LFHDR","p","2016"
> "TRNSFRREQ","p","2","A","4","U","a"
> "LFTRLR","p","1","4"
> "FTRLR","5","4"
>
> I did figure out that using 2.18.0-SNAPSHOT works and one can now insert a
> Handler so I am debugging that right now.
>
> Thanks
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.
> com/Camel-BeanIODataFormat-Configure-ErrorHandler-for-BeanIO-Reader-
> tp5787005p5787071.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>

Re: Camel BeanIODataFormat Configure ErrorHandler for BeanIO Reader

Posted by Brad Johnson <br...@mediadriver.com>.
By the way, I almost forgot to ask. How big are your input files?  If they
aren't enormous you can unmarshal the whole file in one gulp and if
something is not right it will break right there without any processing. If
it succeeds you simply iterate over the now unmarshaled beans.

On Thu, Sep 1, 2016 at 1:03 PM, Brad Johnson <br...@mediadriver.com>
wrote:

> If that works then great.  If you want to reject the file you'll likely
> have to run the file twice.  The first for validation and the second for
> processing.  Remember if you're streaming these and processing them and
> then get a bad record like the one with the missing field, you've already
> processed a good number of records and won't be able to reject the file.
> Either that or you'll have to get into some sort of transaction and
> rollback.
>
> Brad
>
> On Wed, Aug 31, 2016 at 1:50 PM, spurcell <sc...@mastercard.com>
> wrote:
>
>> Hello Brad,
>>
>> Here is an expected file (simplified down for discussion)
>> "FHDR","1","t","20160"
>> "LFHDR","p","4","2016"
>> "TRNSFRREQ","p","2","A","4","U","a"
>> "LFTRLR","p","1","4"
>> "FTRLR","5","4"
>>
>>
>> When a user sends in a bad file (2 FHDR files) I want to reject the file.
>> "FHDR","1","t","20160"
>> "FHDR","1","t","20160"
>> "LFHDR","p","4","2016"
>> "TRNSFRREQ","p","2","A","4","U","a"
>> "LFTRLR","p","1","4"
>> "FTRLR","5","4"
>>
>> If a user sends in a record with a missing field (LFHDR missing the "4"
>> column) I would like to capture that in the reader and reject the file.
>>
>> "FHDR","1","t","20160"
>> "LFHDR","p","2016"
>> "TRNSFRREQ","p","2","A","4","U","a"
>> "LFTRLR","p","1","4"
>> "FTRLR","5","4"
>>
>> I did figure out that using 2.18.0-SNAPSHOT works and one can now insert a
>> Handler so I am debugging that right now.
>>
>> Thanks
>>
>>
>>
>> --
>> View this message in context: http://camel.465427.n5.nabble.
>> com/Camel-BeanIODataFormat-Configure-ErrorHandler-for-BeanIO
>> -Reader-tp5787005p5787071.html
>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>
>
>