mercredi 13 mai 2015

Client tracker pattern

Working in C# .Net 4.5

The problem I would like to solve. Given multiple clients on multiple machines, only allow 2 clients to perform the same task at the same time.

my initial thought was to host a session based wcf service that supports AddMe() and RemoveMe() behaviors. If the count exceeds 2, reject the Addme() request in a good manner.

My concern is if a client is behaving poorly and does not call RemoveMe()... well that would be an issue.

Some thoughts

I could require the client to renew its request every X minutes or I kick it off the list.

I could have the client provide WCF connection information so that I can call back to it from the session based service and ask... are you still using me.

I do not really like either of those

I read this Carlos Figueira MSDN blog

However, the client could still be holding the channel accidentally. I want it to specifically say ... Yes I want the resource. Then at least it may simply be lying which i can live with.

Aucun commentaire:

Enregistrer un commentaire