Reputation: 11
We are consuming a 3rd Party Web Service for which inputs will be given from our WCF Service.
Currently we are logging the inputs given to web service method along with current Timestamp value in Flat File.
Once the inputs are logged in Flat File, Request will be passed to web service.
The web service is quick enough to return the response in less than a second. Once we get Response from web service, we again log the web service response into the same flat file along with current timestamp.
The SLA for our consumer is 1 second to get the response from web service. As we do the flat file logging, we could not return the response to consumer in 1 second.
So we are planning to return the response to the consumer and then do Flat File/DB logging so that the consumer will get the response in 1 second.
Is there any way by which we can return the response first and then do a Flat File / DB Logging.
Upvotes: 1
Views: 54
Reputation: 31770
Yes, do your logging asynchronously.
If you're not using a logging framework/library to do your logging then you should be. Many of the free, standard frameworks out there allow you to log on a fire-and-forget basis.
For example:
Upvotes: 1