Hello,
I have a asp.net web application to call a function in WCF service to send SMS message. After sending a message, the WCF service needs to keep checking a virtual inbox at SMS provider and notify my web application if there is any new reply. There may be more than one web app to use this service. What's a good way to implement this?
Currently I have a function in WCF service like this, it's a OneWay operation contract. I am thinking to configure the instance management as PerSession.
public void Send(SMSMessage message)
{
bool startRetrieving = _smsContext.Send(message);
//keep polling virtual inbox to retrieve replies until it's expired
while (startRetrieving && DateTime.Now < message.ReplyExpiry)
{
//send a http request to check inbox
//if there is any new reply, notify my web application by making
//a http request
//Check the inbox every xxxx seconds.
System.Threading.Thread.Sleep(xxxx);
}
//if it is expired, tell sender app that time to receiving reply is expired
}