Setup WCF Service running in IIS 6 Caching - Enterprise.Caching
There's a business need to hold on to a message for a x amount of time(cache).
Another process will remove it from the cache. We may receive another message that will remove this message from the cache and prevent it from processing.
One way that I though of doing this is
- Receive message1 and put in cache for (x) minutes
- Start a new thread that expires in (x - 1) minutes
- Receive s开发者_JAVA百科econd message that affects first - removes first message from cache
- Thread expires if message1 still exist forward to datastore
Any suggestion would be greatly appreciated.
I'd probably spawn a dedicated thread that checked every N seconds to see if any messages are ready to be moved out of the cache.
One important thing about caching WCF Message objects -- make sure you're creating a buffered copy of each Message before you store it (use Message.CreateBufferedCopy). With some transports, the WCF message will actually point to the network stream, and the network will be blocked until the message is read.
精彩评论