Author |
Message
|
mqxplorer |
Posted: Thu Oct 18, 2012 12:45 pm Post subject: Reading a corresponding file using FileInput Node |
|
|
 Master
Joined: 22 Jun 2009 Posts: 206
|
Hi All,
I have a requirement where I have to read a file from an FTP Server and get the filename. I need to get a corresponding file with the same name as the file I read brfore, however, I need to read it from a different directory. I though of using two FileInput nodes ... one to read the first file and the second one to read the corresponding file. The question, i have here is.. after getting the filename from the first file read, how can I use it for the other fileInput node to tell it the file pattern so that this FileInput node will read only the file what I am interested in....
The requirement is...
I read a file from one location on an FTPServer and need to transform it to another format to call a web service, however, I need some more info to append to the web service request and for this reason, I need to read another file from from the same server but different directory. The only unique thing (ID) I have, to identify the corresponding file is to use the file name which I got, when I read the first file using the first FileInput node.
Is there a way I can use the file name I got when I read the first file to configure the other FileInput node to ftech the required record only?
Any suggestions to make this design are really appreciated.
Thanks in advance....
Thanks
mqxplorer |
|
Back to top |
|
 |
mqjeff |
Posted: Thu Oct 18, 2012 1:24 pm Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
There are only really horrible and painful ways to solve this in Broker.
It is a better idea to look at using something like WebsphereMQ File Transfer Edition to deal with the complex movement of interrelated files and then consolidate them into a single useful place for Broker to process. |
|
Back to top |
|
 |
mqxplorer |
Posted: Fri Oct 19, 2012 7:47 am Post subject: |
|
|
 Master
Joined: 22 Jun 2009 Posts: 206
|
Can we assign the File Pattern Property dynamically on the FileInput node?
Is there such chance?
Thanks
mqxplorer |
|
Back to top |
|
 |
mqjeff |
Posted: Fri Oct 19, 2012 8:35 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
There are no properties on any input nodes that can be changed as the result of the actions of the flow that is driven by that input node.
I repeat. There are only horrible and ugly ways to do what you are trying to do in Broker.
The *least* horrible and painful and ugly way is to use a JavaCompute node to fetch the second file using standard java libraries to handle ftp or file system access.
Otherwise, again, I strongly encourage you to look outside of Broker to simplify the problem that broker has to solve. |
|
Back to top |
|
 |
McueMart |
Posted: Fri Oct 19, 2012 8:44 am Post subject: |
|
|
 Chevalier
Joined: 29 Nov 2011 Posts: 490 Location: UK...somewhere
|
As Jeff said, this sounds like a perfect opportunity to use MQ FTE. You even have the MQ FTE nodes in broker for easy integration. |
|
Back to top |
|
 |
zpat |
Posted: Fri Oct 19, 2012 11:09 pm Post subject: |
|
|
 Jedi Council
Joined: 19 May 2001 Posts: 5866 Location: UK
|
McueMart wrote: |
As Jeff said, this sounds like a perfect opportunity to use MQ FTE. You even have the MQ FTE nodes in broker for easy integration. |
FTE is not a free product, if only it was as simple as making a choice to use it instead of the major battle with budgets, purchasing, license management etc. |
|
Back to top |
|
 |
mqjeff |
Posted: Sat Oct 20, 2012 6:13 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
zpat wrote: |
McueMart wrote: |
As Jeff said, this sounds like a perfect opportunity to use MQ FTE. You even have the MQ FTE nodes in broker for easy integration. |
FTE is not a free product, if only it was as simple as making a choice to use it instead of the major battle with budgets, purchasing, license management etc. |
Well, as of MQ 7.5, there is a license option for MQ that gives you FTE "for free". |
|
Back to top |
|
 |
zpat |
Posted: Sat Oct 20, 2012 8:47 am Post subject: |
|
|
 Jedi Council
Joined: 19 May 2001 Posts: 5866 Location: UK
|
It's an extra cost to any existing license. You guys at IBM can presumably just get hold of whatever IBM software you want. It's very different out there in the real world. If MQ client wasn't free - most projects that I come across would be using FTP...! |
|
Back to top |
|
 |
mqjeff |
Posted: Sat Oct 20, 2012 9:15 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
zpat wrote: |
It's an extra cost to any existing license. You guys at IBM can presumably just get hold of whatever IBM software you want. It's very different out there in the real world. If MQ client wasn't free - most projects that I come across would be using FTP...! |
I've been careful to *suggest* FTE and not *recommend* it. I've recommend a solution *outside* of Broker, and merely *like* FTE, not specifically FTE.
This kind of coordinated file interaction is in general a bad idea from an overall communications point of view. Architecturally it implies a cross dependency between unrelated systems.
Whatever system is producing the first file should instead consume the second file and output that instead of the first file. Then instead of having two files to fetch, there is one file that can be pushed.
It's like if I sent you a letter that says that I've sent a package to be held at the post office. It's a waste of effort and requires extra work on your side. |
|
Back to top |
|
 |
rekarm01 |
Posted: Sat Oct 20, 2012 10:32 am Post subject: Re: Reading a corresponding file using FileInput Node |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 1415
|
mqxplorer wrote: |
I thought of using two FileInput nodes ... one to read the first file and the second one to read the corresponding file. |
Why not use a FileRead node instead, to read the second file? Unlike the FileInput node, it can use the LocalEnvironment to specify the directory and filename. |
|
Back to top |
|
 |
mqjeff |
Posted: Sat Oct 20, 2012 4:36 pm Post subject: Re: Reading a corresponding file using FileInput Node |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
rekarm01 wrote: |
mqxplorer wrote: |
I thought of using two FileInput nodes ... one to read the first file and the second one to read the corresponding file. |
Why not use a FileRead node instead, to read the second file? Unlike the FileInput node, it can use the LocalEnvironment to specify the directory and filename. |
Presumably the second file is not available on a local file system and must be FTPd or etc. to be retrieved. |
|
Back to top |
|
 |
rekarm01 |
Posted: Sat Oct 20, 2012 5:01 pm Post subject: Re: Reading a corresponding file using FileInput Node |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 1415
|
mqjeff wrote: |
Presumably the second file is not available on a local file system and must be FTPd or etc. to be retrieved. |
The problem description seemed to suggest otherwise:
mqxplorer wrote: |
I read a file from one location on an FTPServer and ... need to read another file from from the same server but different directory. |
The term 'FTPServer' is a bit misleading, but if the OP were contemplating two FileInput nodes to read two files, then that would imply both files are available locally; if there were any sort of file transfer, then it would be taking place outside the scope of the message flow.
If that's the case, then a FileInput+FileRead node is a fairly straightforward solution. If that's not the case, then the OP might want to clarify the problem description. |
|
Back to top |
|
 |
mqjeff |
Posted: Sun Oct 21, 2012 5:48 am Post subject: Re: Reading a corresponding file using FileInput Node |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
rekarm01 wrote: |
mqjeff wrote: |
Presumably the second file is not available on a local file system and must be FTPd or etc. to be retrieved. |
The problem description seemed to suggest otherwise:
mqxplorer wrote: |
I read a file from one location on an FTPServer and ... need to read another file from from the same server but different directory. |
The term 'FTPServer' is a bit misleading, but if the OP were contemplating two FileInput nodes to read two files, then that would imply both files are available locally; if there were any sort of file transfer, then it would be taking place outside the scope of the message flow.
If that's the case, then a FileInput+FileRead node is a fairly straightforward solution. If that's not the case, then the OP might want to clarify the problem description. |
I find nothing ambiguous about "FTPServer" and the use of "the same server" to refer to a machine that is not hosting the Broker.
Neither file is local to the Broker. There's no reason to believe it is. FileRead is therefore not a viable option. |
|
Back to top |
|
 |
rekarm01 |
Posted: Sun Oct 21, 2012 6:49 am Post subject: Re: Reading a corresponding file using FileInput Node |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 1415
|
mqjeff wrote: |
I find nothing ambiguous about "FTPServer" and the use of "the same server" to refer to a machine that is not hosting the Broker.
Neither file is local to the Broker. There's no reason to believe it is. FileRead is therefore not a viable option. |
Ok, my mistake. I had assumed that the FileInput node didn't support ftp either, therefore both files must have been local.
I should have double-checked with the InfoCenter first ... |
|
Back to top |
|
 |
|