Announcement Announcement Module
Collapse
No announcement yet.
Logging complete file name in BATCH_JOB_PARAMS table Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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
    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.

    Comment


    • #3
      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!

      Comment


      • #4
        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.

        Comment


        • #5
          That is very helpful. Thanks a lot!

          Comment

          Working...
          X