Groups | Blog | Home
all groups > asp.net webservices > june 2008 >

asp.net webservices : Architectural issue , threading


adrian.vladimirov@gmail.com
6/6/2008 2:43:43 AM
so thats what I have :
a web service, lets say is called "Facility" and it`s primary goal is
to submit some information to the database.
the problem comes, when from another service/app (consumer) I send
such information to the Facility service..
all works fine, but in the end the "consumer" wants to make an report
(select) from the database , to recieve what has been saved (report).

of course the problem is the concurrence between the services.. while
the calling one is done with all the async seding to the Facility
service, it makes request to build the report. But meanwhile NOT all
of the data has been submitted to the databasa, due to traffic/sql
server concurrency and so forth..

the easiest workaround is to force a waiting time before requesting
the report, but I think you can offer a smarter approach when no time
is wasted on sleep mode ..

the "Facility" service is builded on .net 3.5 WCF , hosted by ASP.NET
IIS6 with the conditions :

[ServiceBehavior(InstanceContextMode = InstanceContextMode.Single,
ConcurrencyMode = ConcurrencyMode.Multiple,
IncludeExceptionDetailInFaults = true)]

I tried a solution with an EXTRA call to the service, to explicitly
check if all the data has been submited, but this way the extra call
can EVEN happen before the service has recieved all the previous data
of the wire ..

Tiago Halm
6/7/2008 4:00:04 AM
Make sure the 2 webservice operations implemented in the "Facility" service
are synchronized.on a critical section (monitor). That way a report can only
be generated when no writing takes place and information is only submitted
to the database when no report is being generated.

Its not the client the one making sure the data is written, its the service
that makes sure all exposed operations are executed consistently when
required - in this case its required because both operations share a single
resource, the database.

Tiago Halm

[quoted text, click to view]

Registered User
6/7/2008 7:13:47 AM
On Fri, 6 Jun 2008 02:43:43 -0700 (PDT), adrian.vladimirov@gmail.com
[quoted text, click to view]
Why not add a third service that writes the data and then returns the
report? Clients that require a report after data submission can make
async calls to this service.

regards
AddThis Social Bookmark Button