Author |
Message
|
SANTYP |
Posted: Thu Jan 15, 2009 11:20 pm Post subject: File Input Node of v6.1 |
|
|
 Centurion
Joined: 27 Mar 2007 Posts: 142
|
Hi All,
I am not able to get number of files in the directory in esql can somebody help me how to get the count of files in esql.
Thanks in advance |
|
Back to top |
|
 |
Vitor |
Posted: Fri Jan 16, 2009 12:58 am Post subject: Re: File Input Node of v6.1 |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
SANTYP wrote: |
I am not able to get number of files in the directory in esql can somebody help me how to get the count of files in esql.
|
AFAIK you can't
Why would you need to? _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
SANTYP |
Posted: Fri Jan 16, 2009 2:26 am Post subject: |
|
|
 Centurion
Joined: 27 Mar 2007 Posts: 142
|
i have to set all file name from input to output xml i.e contain multiple elements of file field,but it is picking one file at a time ,after completion of one file another file comes into existence.
EX:i have 5 files in directory ,i have to map all five files name and generate single output xml with multiple file element.
like
<header>
<file>file1</file>
<file>file2</file>
<file>file3</file>
<file>file4</file>
<file>file5</file>
</header> |
|
Back to top |
|
 |
Vitor |
Posted: Fri Jan 16, 2009 2:55 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
SANTYP wrote: |
EX:i have 5 files in directory ,i have to map all five files name and generate single output xml with multiple file element.
|
Well don't you have a problem.....!
Someone more ingenious than me will be along in a minute with a suggestion.  _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
mqpaul |
Posted: Fri Jan 16, 2009 3:00 am Post subject: The V6.1 File nodes cannot handle this application design |
|
|
 Acolyte
Joined: 14 Jan 2008 Posts: 66 Location: Hursley, UK
|
SANTYP wrote: |
i have to set all file name from input to output xml i.e contain multiple elements of file field,but it is picking one file at a time ,after completion of one file another file comes into existence.
EX:i have 5 files in directory ,i have to map all five files name and generate single output xml with multiple file element.
like
<header>
<file>file1</file>
<file>file2</file>
<file>file3</file>
<file>file4</file>
<file>file5</file>
</header> |
As you have found, the file nodes process one file at a time. You can set up your flow so that all of the output goes to a single file of XML by using File Output node "Record is unmodified data" record creation. Then you need to send a message on the "Finish File" terminal when all (in your example 5) files are done. That needs some extra logic in your flow.
However, I think you are saying that as the File Input node processes each file, it deletes it or moves it to a different directory, and at that point the feeding system creates a new input file. In that case, your logic would need to know which input files belong to which output files, otherwise it would keep writing the new files to the same output and never end.
This seems a fragile application design. You are using the contents of the input directory at a particular point in time as the definition of a single message, but you are allowing additions to that directory while the flow processes this message. This has problems. For example, what if the flow starts before all the input files have arrived? Later files that should be part of the current message will instead be included in the next record. What if the next record has more files? Does the feeding system know not to move the new files into the input directory until all the flow has processed all the previous message's files? _________________ Paul |
|
Back to top |
|
 |
fjb_saper |
Posted: Fri Jan 16, 2009 3:46 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
I would add some suggestion to Paul's very informative post:
IMHO you need some process either before the broker or after the broker that will assemble your individual files into a single file that would then be processed by the next step (broker or whatever does this post broker).
For the sake of integrity and as the feeding process seems to be waiting on the move/deletion to create another one, this process should be fronting the broker. It could be triggered by the FTP once all files in a series have been put out there. I expect the FTP to be waiting until the first file is available and then put out all 5 in a unit.... or something like that... Otherwise you will need a lot of extra logic to be able to assemble the correct file components into a single file ready for consumption.
Have fun  _________________ MQ & Broker admin |
|
Back to top |
|
 |
mqjeff |
Posted: Fri Jan 16, 2009 4:15 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
It's not clear that SANTYP is actually using FileInput at all.
If FileInput is being used, one can use Collector node as well.
Otherwise, SANTYP can consider using Java instead of ESQL to get a list of files in some random directory at some given point in time. |
|
Back to top |
|
 |
|