Results 1 to 5 of 5

Thread: Logging complete file name in BATCH_JOB_PARAMS table

  1. #1

    Default Logging complete file name in BATCH_JOB_PARAMS table

    Hi Guys,

    I am passing file name as job parameter like file:/test/PO_TR_*.TXT . In database this is getting
    logged as same.

    But I want to log the complete file name like 'file:/test/PO_TR_020120091129' in BATCH_JOB_PARAMS table.

    Can anybody tell me how this can be done?

    Thank You

  2. #2
    Join Date
    Dec 2006
    Posts
    1,061

    Default

    The only thing I can think of is to actually resolve the resource before launching. You could probably use a composite JobLauncher to do this. Either that or us a listener to write the value out somewhere else.

  3. #3

    Default

    Thanks for yor reply. I am still not sure how this can be done. Pardon me if this is a stupid question.

    CompisiteJobLauncher may not work for my case. I use MultiResourceItemReader and I think its 'resources' property takes a directory or a pattern like PO_* for finding list of files.

    So the other option is using a listener and write to another table. Can you tell me how the listener can access 'resource' property of a FlatFileItemReader? What listner should I use?

    I appreciate your time and help!

  4. #4
    Join Date
    Feb 2008
    Posts
    488

    Default

    Since the MultiResourceItemReader has a delegate of type ResourceAwareItemReaderItemStream, normally you would pass your FlatFileItemReader in as the delegate. The MRIR finds a resource and passes it to the FFIR (via the setResource method) before starting to read.

    To capture the filename, you should insert a layer in between that the resource must pass through to get to the FFIR. You should proxy the FFIR (implementing ResourceAwareItemReaderItemStream). Your proxy's setResource method will pass the given resource to it's delegate FFIR, but it should also store the filename in a list. You can also have an afterStep listener method on your proxy that logs out the list of filenames.

  5. #5

    Default

    That is very helpful. Thanks a lot!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •