Author |
Message
|
iib |
Posted: Thu Aug 27, 2015 10:45 am Post subject: Validate if file exists within the compute node |
|
|
Apprentice
Joined: 26 Jun 2015 Posts: 27
|
Hi,
Someone knows how I can validate if a file exists in a path specifies where the broker is. From node compute |
|
Back to top |
|
 |
mqjeff |
Posted: Thu Aug 27, 2015 10:59 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
The compute node only lets you write ESQL.
If ESQL lets you work with files on the broker system, then these commands will be documented in the ESQL sections of the Knowledge Center.
Please see my signature, below. _________________ chmod -R ugo-wx / |
|
Back to top |
|
 |
Vitor |
Posted: Thu Aug 27, 2015 11:02 am Post subject: Re: Validate if file exists within the compute node |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
iib wrote: |
Someone knows how I can validate if a file exists in a path specifies where the broker is. From node compute |
Why?
Aside from the most excellent advice of my most worthy associate in this matter, what requirement are you trying to meet with this? If the flow needs this file to process, it will either find it (and follow the needed processing logic) or not (and follow the needed error processing logic). _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
iib |
Posted: Thu Aug 27, 2015 11:09 am Post subject: |
|
|
Apprentice
Joined: 26 Jun 2015 Posts: 27
|
I need to validate if the file exists on the target , because if there is going to rename the file name with a flag indicating that the file was processed and so whether to send the file with the FileOutput node. |
|
Back to top |
|
 |
mqjeff |
Posted: Thu Aug 27, 2015 11:11 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
No.
You need to read about the basic capabilities of the FileOutput node, and then read about the capabilities of the ESQL language.
And then you need to revisit your business requirement, rather than what you think is your technical requirement.
And then you need to consider who's job it is to determine that a given file has been processed. _________________ chmod -R ugo-wx / |
|
Back to top |
|
 |
iib |
Posted: Thu Aug 27, 2015 11:27 am Post subject: |
|
|
Apprentice
Joined: 26 Jun 2015 Posts: 27
|
Thank you very much for the answers, it is a requirement to rename the existing file, the output node properties file does not allow me to put the brand you want, so what should I do before going to this node with either a compute node or java compute, yet I doubt if it can be done with esql compute node. |
|
Back to top |
|
 |
mqjeff |
Posted: Thu Aug 27, 2015 11:32 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
Read about the properties of the FileOutput node.
For the second time.
For the second time, who's job is it to decide that a file has been processed?
You are writing a file out to some location. If some other program is supposed to process it, how will you know if that other program has halted? _________________ chmod -R ugo-wx / |
|
Back to top |
|
 |
Vitor |
Posted: Thu Aug 27, 2015 11:46 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
iib wrote: |
I need to validate if the file exists on the target , because if there is going to rename the file name with a flag indicating that the file was processed and so whether to send the file with the FileOutput node. |
This makes no sense at all.
Why would you use any application to rename a file to indicate some other application had processed it given that only the application processing the file can know if it actually processed the file or not? If the assumption is that if it's in the target directory that must be because the other application processed it, then that's one heck of an assumption.
Given that you're making that assumption, why are you using something as heavy as IIB to do this? You can do this with a shell script.
iib wrote: |
and so whether to send the file with the FileOutput node |
Send the file where? Again, why do this with IIB? If the requirement is as simple as "rename the file and send it on", then you're paying the IIB license for something you can do with a shell script or any number of much cheaper file transfer control utilities. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
iib |
Posted: Thu Aug 27, 2015 11:47 am Post subject: |
|
|
Apprentice
Joined: 26 Jun 2015 Posts: 27
|
If the source sends multiple files with the same name, it is desired that the file is renamed with a specific brand and not the output file properties allows node. |
|
Back to top |
|
 |
Vitor |
Posted: Thu Aug 27, 2015 11:52 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
iib wrote: |
If the source sends multiple files with the same name, it is desired that the file is renamed with a specific brand and not the output file properties allows node. |
So if the source (presumably this other application) sends a file you send it via the FileOutput node. That's a dubious use for IIB.
If it sends another one with the same name, you're supposed to rename it to indicate that it's already processed? That's a dubious use for IIB.
Do I have that right? _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
iib |
Posted: Thu Aug 27, 2015 11:55 am Post subject: |
|
|
Apprentice
Joined: 26 Jun 2015 Posts: 27
|
No integration is much broader than renaming the file, this is just a point of flow is important to know when one file was processed without having to send it to the mqsiarchive folder.
step |
|
Back to top |
|
 |
mqjeff |
Posted: Thu Aug 27, 2015 11:57 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
So you want to tell the FileOutput node to use a different name. _________________ chmod -R ugo-wx / |
|
Back to top |
|
 |
iib |
Posted: Thu Aug 27, 2015 12:03 pm Post subject: |
|
|
Apprentice
Joined: 26 Jun 2015 Posts: 27
|
For example if the test.txt file exists in the destination, I validate whether this file exists in order to rename with test1.txt, test2.txt, etc so you can determine that the same file has been processed n times. |
|
Back to top |
|
 |
Vitor |
Posted: Thu Aug 27, 2015 12:10 pm Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
iib wrote: |
For example if the test.txt file exists in the destination, I validate whether this file exists in order to rename with test1.txt, test2.txt, etc so you can determine that the same file has been processed n times. |
As a process or system design, that's just contact admin.
As a matter of curiosity, why not just put the previous versions in mqsiarchive with a timestamp? That would not only tell you how many times the file had been processed, but when.
If we assume you're unwilling or unable to just record within the flow how many times you've seen this file, then your only option is to write some custom Java to check for it. You can't do this with ESQL because in any sane process with which IIB should be involved, you don't need to.
Read up on the restrictions and dangers of accessing external resources outside of broker's control before attempting this. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
iib |
Posted: Thu Aug 27, 2015 12:27 pm Post subject: |
|
|
Apprentice
Joined: 26 Jun 2015 Posts: 27
|
Thank you very much for the clarifications, the same argument to place the file with the date of the folder mqsiarchive process was proposed, but not want to have this folder infraestructrua issues, however if nodes are used as JavaCompute and only consultation if the file exists before sending it to the destination you exit the Broker that danger may have with this process ?. |
|
Back to top |
|
 |
|