Author |
Message
|
iamfat |
Posted: Mon May 07, 2012 10:00 pm Post subject: How to delete a file in MessageFlow.?????? |
|
|
Apprentice
Joined: 08 Mar 2012 Posts: 32 Location: China
|
I need to delete a file in local, list the file that expired, and delete these files.
How to delete the file? Do i have to use the JCN to delete the file ?
Can the file input node or other node can solve this problem.
Thank you.. |
|
Back to top |
|
 |
mjain |
Posted: Tue May 08, 2012 1:56 am Post subject: |
|
|
 Novice
Joined: 01 May 2012 Posts: 15
|
Is suggested to use JCN for IO operations. You can have a java class and use JCN to get the task done. |
|
Back to top |
|
 |
smdavies99 |
Posted: Tue May 08, 2012 3:01 am Post subject: |
|
|
 Jedi Council
Joined: 10 Feb 2003 Posts: 6076 Location: Somewhere over the Rainbow this side of Never-never land.
|
Have you looked at the support packs? There is one there that could do it for you... (hint it has the work 'JOB' in the title) _________________ WMQ User since 1999
MQSI/WBI/WMB/'Thingy' User since 2002
Linux user since 1995
Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions. |
|
Back to top |
|
 |
mqjeff |
Posted: Tue May 08, 2012 3:32 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
what does it mean? list the file that expired?
You can certainly use a FileInput node, instruct it to not save a copy of the file, and choose not to output the data anywhere. |
|
Back to top |
|
 |
Esa |
Posted: Tue May 08, 2012 3:57 am Post subject: Re: How to delete a file in MessageFlow.?????? |
|
|
 Grand Master
Joined: 22 May 2008 Posts: 1387 Location: Finland
|
iamfat wrote: |
I need to delete a file in local, list the file that expired, and delete these files.
|
I am not sure I understand what you mean. How does a file expire?
Does deleting a file in local, whatever it means, produce a list of expired files?
You can delete a file with FileRead node. Select Action Delete in Basic/Finish File. |
|
Back to top |
|
 |
lancelotlinc |
Posted: Tue May 08, 2012 5:07 am Post subject: |
|
|
 Jedi Knight
Joined: 22 Mar 2010 Posts: 4941 Location: Bloomington, IL USA
|
From a JCN or an ESQL Compute, you can execute any command line you want. Why did you not want to do this? From these nodes, you can delete files, list files and file attributes. _________________ http://leanpub.com/IIB_Tips_and_Tricks
Save $20: Coupon Code: MQSERIES_READER |
|
Back to top |
|
 |
Esa |
Posted: Tue May 08, 2012 6:26 am Post subject: |
|
|
 Grand Master
Joined: 22 May 2008 Posts: 1387 Location: Finland
|
lancelotlinc wrote: |
From a JCN or an ESQL Compute, you can execute any command line you want. Why did you not want to do this? From these nodes, you can delete files, list files and file attributes. |
I must admit that I don't know how to call command line from ESQL. The only way I know is to create a function wrapper for a java static method. |
|
Back to top |
|
 |
mqjeff |
Posted: Tue May 08, 2012 6:29 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
Esa wrote: |
lancelotlinc wrote: |
From a JCN or an ESQL Compute, you can execute any command line you want. Why did you not want to do this? From these nodes, you can delete files, list files and file attributes. |
I must admit that I don't know how to call command line from ESQL. The only way I know is to create a function wrapper for a java static method. |
that's what he meant. |
|
Back to top |
|
 |
iamfat |
Posted: Tue May 08, 2012 4:46 pm Post subject: |
|
|
Apprentice
Joined: 08 Mar 2012 Posts: 32 Location: China
|
mjain wrote: |
Is suggested to use JCN for IO operations. You can have a java class and use JCN to get the task done. |
Thank you ,
Maybe JCN is better. |
|
Back to top |
|
 |
iamfat |
Posted: Tue May 08, 2012 4:48 pm Post subject: |
|
|
Apprentice
Joined: 08 Mar 2012 Posts: 32 Location: China
|
smdavies99 wrote: |
Have you looked at the support packs? There is one there that could do it for you... (hint it has the work 'JOB' in the title) |
yeah. i had searched the help content.
but haven't found any useful information.  |
|
Back to top |
|
 |
iamfat |
Posted: Tue May 08, 2012 4:52 pm Post subject: |
|
|
Apprentice
Joined: 08 Mar 2012 Posts: 32 Location: China
|
mqjeff wrote: |
what does it mean? list the file that expired?
You can certainly use a FileInput node, instruct it to not save a copy of the file, and choose not to output the data anywhere. |
Sorry, my english is not very good. Let me explain it.
I have a flow that will generate some files, and ftp these files to an FTP server.
And then, move the ftped file to another archive folder in local.
I need another flow, that will triggered on 0:00 everyday, that flow will delete the file in the archive folder that was generated 10 days ago.
The question is i don't know how to delete the file. There is no fileDeleteNode in the Palette. So i'm not sure whether should i use the JCN to do this job. |
|
Back to top |
|
 |
iamfat |
Posted: Tue May 08, 2012 4:57 pm Post subject: Re: How to delete a file in MessageFlow.?????? |
|
|
Apprentice
Joined: 08 Mar 2012 Posts: 32 Location: China
|
Esa wrote: |
iamfat wrote: |
I need to delete a file in local, list the file that expired, and delete these files.
|
I am not sure I understand what you mean. How does a file expire?
Does deleting a file in local, whatever it means, produce a list of expired files?
You can delete a file with FileRead node. Select Action Delete in Basic/Finish File. |
Yeah, that will delete all file. But i need to delete the file that generated 10 days ago. Or maybe i need to use a JCN first, create a wildcard to the FileReadNode, that delete the right file.
For example:
TEST_FILE_2012_04_30_00004.txt.
I need to create a wildcard to the FileReadNode as TEST_FILE_2012_04_30_*.txt
 |
|
Back to top |
|
 |
iamfat |
Posted: Tue May 08, 2012 4:59 pm Post subject: |
|
|
Apprentice
Joined: 08 Mar 2012 Posts: 32 Location: China
|
lancelotlinc wrote: |
From a JCN or an ESQL Compute, you can execute any command line you want. Why did you not want to do this? From these nodes, you can delete files, list files and file attributes. |
thank you,
i'll do some test for this.
I'm not familiar with ESQL yet.  |
|
Back to top |
|
 |
marko.pitkanen |
Posted: Tue May 08, 2012 10:08 pm Post subject: |
|
|
 Chevalier
Joined: 23 Jul 2008 Posts: 440 Location: Jamsa, Finland
|
Hi,
I wonder if you have to do archive cleaning with message flow? Could you do it instead with cron scheduled shell script?
--
Marko |
|
Back to top |
|
 |
Esa |
Posted: Tue May 08, 2012 10:59 pm Post subject: Re: How to delete a file in MessageFlow.?????? |
|
|
 Grand Master
Joined: 22 May 2008 Posts: 1387 Location: Finland
|
iamfat wrote: |
Yeah, that will delete all file. But i need to delete the file that generated 10 days ago. Or maybe i need to use a JCN first, create a wildcard to the FileReadNode, that delete the right file.
For example:
TEST_FILE_2012_04_30_00004.txt.
I need to create a wildcard to the FileReadNode as TEST_FILE_2012_04_30_*.txt
 |
You are getting closer. But the FileRead will delete only one file, so you will have to propagate to it several times untill the FileRead node propagates to 'no match' terminal.
You don't need a JCN, you can use ESQL as well to create a Local Environment override for the file name. Unless you prefer java to ESQL, of course.
But I very much agree with Marko, this is a simple maintenance task for which a sheduled shell script might be more suitable.
If you implement a flow that cleans up after itself, you need to plan transcationality and exception handling scopes carefully. Otherwise you risk rolling back the business logic part of the flow if the maintenance logic part happens to fail... ... yes, JCN gives you more control on exception handling and makes this task easier and gives better performance. Only in right hands, though. |
|
Back to top |
|
 |
|