Author |
Message
|
csjayakumar |
Posted: Tue Jan 03, 2012 2:15 pm Post subject: Reading the name of a file without parsing |
|
|
Newbie
Joined: 03 Jan 2012 Posts: 3
|
Hi,
I have this requirement to read the name of the files present in a folder and do some validation before actually reading the content of the file. (The file name has date and I need to ignore files that are older that a particular date)
I tried using 2 FileRead Nodes - 1st one to just get the file name and the 2nd one to actually parse the file.
But 1st node is throwing error even though I have set the message Domain as "BLOB : For messages with an unspecified format". I assumed that this way it will not try to parse the file.
I also believe that using a FileRead node for just getting the file name is not an optimal approach. Wondering if there is any better approach. Have not worked with JCN. Probably that is the way to go....
Appreciate your response.
Thank you! |
|
Back to top |
|
 |
Vitor |
Posted: Tue Jan 03, 2012 2:50 pm Post subject: Re: Reading the name of a file without parsing |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
csjayakumar wrote: |
But 1st node is throwing error even though I have set the message Domain as "BLOB : For messages with an unspecified format". I assumed that this way it will not try to parse the file. |
You'd think that. I certainly would. Given that you've not seen fit to give any details about the error I can't be conclusive that it's not a parser error but I imagine it's a different problem.
csjayakumar wrote: |
I also believe that using a FileRead node for just getting the file name is not an optimal approach. |
You think?
csjayakumar wrote: |
Wondering if there is any better approach. |
I'd use a FileInput node.
csjayakumar wrote: |
Have not worked with JCN. Probably that is the way to go.... |
Once you've taught yourself Java, I'm sure you'll be able to invent a perfectly wonderful wheel.
How are you triggering this flow, given that neither a FileRead or a JCN are input nodes? _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
kash3338 |
Posted: Wed Jan 04, 2012 9:23 am Post subject: |
|
|
Shaman
Joined: 08 Feb 2009 Posts: 709 Location: Chennai, India
|
Using a FileInput node as suggested by Vitor is a better option here. You have the file name available in the Local Environment when you read the file and you can check the File name from that and parse if required.
The File name is also available as Wildcard when read from FileInput node |
|
Back to top |
|
 |
csjayakumar |
Posted: Wed Jan 04, 2012 12:31 pm Post subject: |
|
|
Newbie
Joined: 03 Jan 2012 Posts: 3
|
Thank you so much guys for the reply.
Vitor, my flow gets started via MQinput. But yes, I should have achieved this with FileRead as well, but getting some weird exception.
I am from Java background and moved to broker recently. I was advised not to use JCN and stick with ESQL
Read few articles stating that there is no performance impact with usage of JCN with later versions of Broker. My issue is resolved with Java file operations  |
|
Back to top |
|
 |
Vitor |
Posted: Wed Jan 04, 2012 12:40 pm Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
csjayakumar wrote: |
Vitor, my flow gets started via MQinput. |
Why? What's in the message? Why doesn't it contain the file name you need?
csjayakumar wrote: |
But yes, I should have achieved this with FileRead as well, but getting some weird exception. |
Now you'd think IBM would have put more detail in the error message than "something weird happened". Perhaps if you found that and posted it you might have got more assistance here.
csjayakumar wrote: |
I am from Java background and moved to broker recently. I was advised not to use JCN and stick with ESQL  |
This is sound advice. The forum is littered with posts from experienced Java people who have fallen foul of WMB's architecture (i.e. it's not WAS) and other issues.
csjayakumar wrote: |
Read few articles stating that there is no performance impact with usage of JCN with later versions of Broker. |
Post some links to these articles. And performance is not the biggest issue with JCN v ESQL (and ESQL still outperforms Java, though in newer versions of WMB perhaps not by as much). Aside from the problems I alude to above, ESQL has more features than Java within a WMB environment.
csjayakumar wrote: |
My issue is resolved with Java file operations  |
So you've invented a wheel. Is it better than the IBM wheel? Is it using the very expensive WMB software to its fullest advantage? Is it proping up a dubious requirement? Does it scale well? _________________ Honesty is the best policy.
Insanity is the best defence.
Last edited by Vitor on Wed Jan 04, 2012 12:47 pm; edited 1 time in total |
|
Back to top |
|
 |
mqjeff |
Posted: Wed Jan 04, 2012 12:45 pm Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
The LocalEnvironment.File tree contains all of the information you need to resolve this by using a FileInput node, and a secondary configuration to a FileOutput.
I.e. you can use this to filter whether the current file is "too old" or not, and make a decision about what to do with it. |
|
Back to top |
|
 |
|