Author |
Message
|
shrutiagarwal228 |
Posted: Tue Sep 09, 2014 10:09 pm Post subject: Read latest file in a folder |
|
|
Newbie
Joined: 20 Jan 2014 Posts: 3
|
Please help me to understand if there is a possibilty to read the latest file in the folder.
there is no naming convention defined for the file i just want to read the latest file from a folder |
|
Back to top |
|
 |
vicentius |
Posted: Wed Sep 10, 2014 3:02 am Post subject: |
|
|
 Apprentice
Joined: 01 Mar 2013 Posts: 28
|
Please share with us what you want to accomplish. I am curious what is the business case that would require reading the newest file in a folder.
I am also curious if said business case imagined that after the newest file is polled from the input folder and successfully processed, the next newest will be read and so on until, maybe, all files are read. |
|
Back to top |
|
 |
shrutiagarwal228 |
Posted: Wed Sep 10, 2014 3:34 am Post subject: |
|
|
Newbie
Joined: 20 Jan 2014 Posts: 3
|
Yes the requirement is to only pick the newly added file and process.
we need not process the subsequent files. only process the latest file.
Could you please let me know if this is possible in MB |
|
Back to top |
|
 |
vicentius |
Posted: Wed Sep 10, 2014 4:20 am Post subject: |
|
|
 Apprentice
Joined: 01 Mar 2013 Posts: 28
|
shrutiagarwal228 wrote: |
[...]we need not process the subsequent files. only process the latest file.[...] |
So you want to develop a flow that picks exactly one file from the input folder, specifically the latest one. Then process the file according to the requirements of the business process, do something with it. Then what do you do? Stop the flow? Undeploy? Or maybe there's a possibility the flow could be used again in the future, for other files?
To not-really-answer your not-a-question, I could think of ways to do exactly once processing inside a flow, mostly hackish to be honest, but I'm pretty sure this was hardly the use case IBM imagined when developing Message Broker. |
|
Back to top |
|
 |
mqjeff |
Posted: Wed Sep 10, 2014 4:28 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
So what happens if you read the "newest" file, but before you're done processing it, a newer file arrives in the folder? |
|
Back to top |
|
 |
Vitor |
Posted: Wed Sep 10, 2014 5:08 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
shrutiagarwal228 wrote: |
Could you please let me know if this is possible in MB |
So you want to point WMB at a given directory filled with files whose names are random, process only the newest one and stop.
When does it start again? How will the flow (which is now somehow ignoring the directory) know a "new" file arrives? Is this some kind of scheduled process where at some random point in time you process the "newest" file? If so, whatever triggers the flow to start can clear out all the files but the newest before it does so.
You must also have a process to stop the flow again after it's processed the file or it'll start working on the contents of the directory as files arrive. This same process can also notify whoever sent a "newer" file after processing started (as my most worthy associate outlines) that they're out of luck and their processing has failed.
This is a clear use case for a retained publication.  _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
|