Results 1 to 3 of 3

Thread: resource file name access in processor after read by multiresourcereader

  1. #1
    Join Date
    Dec 2012
    Posts
    17

    Default resource file name access in processor after read by multiresourcereader

    Hi,

    any smart suggestions how to access the name of a file inside a processor when the file was read by a MultipleResourceReader configured with wild card pattern before?

    In the processor, I want to access filename A when item A was read from file A and filename B when item B was read from file B.

    Thanks,
    Elmar

  2. #2
    Join Date
    Dec 2012
    Posts
    17

    Default

    I guess injecting MultiResourceItemReader into the processor and then callling its getCurrentResource method is the right approach. I will try and let you know...

  3. #3
    Join Date
    Sep 2008
    Location
    Chicagoland, IL
    Posts
    351

    Default

    That is a bad way to do this. If you are willing to use the current nightly build, we have added a ResourceAware interface. By implementing this interface on your item, the MultiResourceItemReader will inject the resource the item came from into the item for future reference. You can read more about it here: https://jira.springsource.org/browse/BATCH-1854
    Michael Minella
    Spring Batch Lead
    Author - Pro Spring Batch
    http://www.michaelminella.com
    Twitter: @MichaelMinella

Posting Permissions

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