473,379 Members | 1,191 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,379 software developers and data experts.

File in use, Catch/Try a number of times

We have a web service that a client can send XML to, and that XML is
appended to a file on the server for each call.

At night, a separate processing console app will process the XML.

How would you recommend this interaction to occur so the web service
doesn't step on the toes of the processing app and vice versa?

I thought of having the console app move the XML file out of the
current folder and put it somewhere else. The WS will then recreate
the XML file for the next day. But if the WS is accessing the file, I
won't be able to move it. Should I just loop for a certain amount of
time until the file is able to be moved?

Then in the WS, if the file is being moved and is access, do the same?
Jan 11 '08 #1
4 1026
"Larry Bud" <la**********@yahoo.comwrote in message
news:de**********************************@i29g2000 prf.googlegroups.com...
How would you recommend this interaction to occur so the web service
doesn't step on the toes of the processing app and vice versa?
Firstly, the absolute last thing I'd do is have a text file on a web server
which can potentially be locked by more than one user - seems like a
disaster waiting to happen...

Instead, every time a client does an upload, I'd create a separate file with
a dynamically created filename - I'd almost certainly construct the filename
based on a combination of the client's unique identifier and a timestamp
e.g. 123-20080111144130.xml or 20080111144130-123.xml. That way you wouldn't
need to worry about file locking or overwriting...

Then I'd set my processing app to run at just after midnight, and design it
so that it polled the folder containing the XML file(s), inspecting the
filename so that it processed only the files where the timetamp portion of
the filename was earlier than the current day, deleting / renaming them
after successful processing...
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Jan 11 '08 #2
On Jan 11, 9:45*am, "Mark Rae [MVP]" <m...@markNOSPAMrae.netwrote:
"Larry Bud" <larrybud2...@yahoo.comwrote in message

news:de**********************************@i29g2000 prf.googlegroups.com...
How would you recommend this interaction to occur so the web service
doesn't step on the toes of the processing app and vice versa?

Firstly, the absolute last thing I'd do is have a text file on a web server
which can potentially be locked by more than one user - seems like a
disaster waiting to happen...

Instead, every time a client does an upload, I'd create a separate file with
a dynamically created filename - I'd almost certainly construct the filename
based on a combination of the client's unique identifier and a timestamp
e.g. 123-20080111144130.xml or 20080111144130-123.xml. That way you wouldn't
need to worry about file locking or overwriting...

Then I'd set my processing app to run at just after midnight, and design it
so that it polled the folder containing the XML file(s), inspecting the
filename so that it processed only the files where the timetamp portion of
the filename was earlier than the current day, deleting / renaming them
after successful processing...
Great advice, thank you very much!
Jan 11 '08 #3
LVP
Do you have to worry about backup issues after midnight?
"Mark Rae [MVP]" <ma**@markNOSPAMrae.netwrote in message
news:OL**************@TK2MSFTNGP05.phx.gbl...
"Larry Bud" <la**********@yahoo.comwrote in message
news:de**********************************@i29g2000 prf.googlegroups.com...
>How would you recommend this interaction to occur so the web service
doesn't step on the toes of the processing app and vice versa?

Firstly, the absolute last thing I'd do is have a text file on a web
server which can potentially be locked by more than one user - seems like
a disaster waiting to happen...

Instead, every time a client does an upload, I'd create a separate file
with a dynamically created filename - I'd almost certainly construct the
filename based on a combination of the client's unique identifier and a
timestamp e.g. 123-20080111144130.xml or 20080111144130-123.xml. That way
you wouldn't need to worry about file locking or overwriting...

Then I'd set my processing app to run at just after midnight, and design
it so that it polled the folder containing the XML file(s), inspecting the
filename so that it processed only the files where the timetamp portion of
the filename was earlier than the current day, deleting / renaming them
after successful processing...
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Jan 11 '08 #4
an additional good trick is to create the file with a name like <unique>.out,
then after its closed rename to <unique>.xml. then the pickup prograg will
not hit open files.

-- bruce (sqlwork.com)
"Mark Rae [MVP]" wrote:
"Larry Bud" <la**********@yahoo.comwrote in message
news:de**********************************@i29g2000 prf.googlegroups.com...
How would you recommend this interaction to occur so the web service
doesn't step on the toes of the processing app and vice versa?

Firstly, the absolute last thing I'd do is have a text file on a web server
which can potentially be locked by more than one user - seems like a
disaster waiting to happen...

Instead, every time a client does an upload, I'd create a separate file with
a dynamically created filename - I'd almost certainly construct the filename
based on a combination of the client's unique identifier and a timestamp
e.g. 123-20080111144130.xml or 20080111144130-123.xml. That way you wouldn't
need to worry about file locking or overwriting...

Then I'd set my processing app to run at just after midnight, and design it
so that it polled the folder containing the XML file(s), inspecting the
filename so that it processed only the files where the timetamp portion of
the filename was earlier than the current day, deleting / renaming them
after successful processing...
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Jan 11 '08 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: Neil Trigger | last post by:
Is there a way of creating a seperate text file on a server every time a form is sent? -- ¿ Trigger ? http://www.magic2k.com/ http://www.oddmap.co.uk
1
by: artie-effim | last post by:
Hey all- I'm doing a filter test and need to identify a .pch file created with MSVC. I am unable to find the file structure defination on-line, and was wondering if someone could point me in the...
18
by: Conrad F | last post by:
Hello all, I am waiting for receipt of files in a directory. I use the FileSystemWatcher to detect when files arrive in said folder. I need to read the data from these files ASAP but the files...
1
by: Bill Rogers | last post by:
I have been trying to get _CrtDumpMemoryLeaks() to report the allocation point file and line number in my source file. Instead it always reports the allocation occurred in crtdbg.h, line 692. I...
2
by: Eduardo Kelly | last post by:
Hi everyone, Does anyone know how to give a openfile a number??? I'll like to open two internet explore windows and give them a number so I can switch between them after several seconds!! ...
12
by: ABN | last post by:
I have a C# (.NET 1.1) application in which I loop over a number of files on the hard drive and delete them. A few times, I've experienced an exception that says the file is in use by another...
0
by: ZRexRider | last post by:
I was asked to set the revision number of my project so it shows up in Windows File properties (when you right click a file and select properties and select the summary tab). It shows up down in...
6
by: ivan.perak | last post by:
Hello, im a beginner in VB.NET... The thing i would like to do is as it follows.... I have a text file (list of names, every name to the next line) which is about 350000 lines long. I would...
1
by: Ela | last post by:
Hallo, I have next problem: When I'm traying export data from table from one column formated like longint (21,111,111.00 ) form access 2003 to the xml, number looks diferent...
4
by: Roberto Mora | last post by:
I have not done programming in a very long time and what is worst, I never learned VB. Although my job does not require this knowledge, I cam across a problem that although it seemed simple it has...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.