I am configuring notifications for my appfabric cache. The first add operation is sending one notification. But When I replace (Update) the same cache Item with a new value or delete that item, I am receiving multiple number of notifications for that single operation. I suspect that it has nothing to do with the type of operation I perform. Because I have seen multiple add notifications too. Is there any configuration I am messing up?? I have written the delegate in my codeback file. It is hitting the delegate continually for some time even for single operation.

My configuration is :

<dataCacheClient requestTimeout="150000" channelOpenTimeout="19000" maxConnectionsToServer="10">
    <localCache isEnabled="true" sync="TimeoutBased" ttlValue="300" objectCount="10000"/>
    <clientNotification pollInterval="30" maxQueueLength="10000" />
    <hosts>
        <host name="192.10.14.20" cachePort="22233"/>

    </hosts>
    <securityProperties mode="None" protectionLevel="None" />
    <transportProperties connectionBufferSize="131072" maxBufferPoolSize="268435456"
                         maxBufferSize="8388608" maxOutputDelay="2" channelInitializationTimeout="60000"
                         receiveTimeout="600000"/>
</dataCacheClient>

And my code which has the delegate is :

  public void myCacheLvlDelegate(string myCacheName, string myRegion, string myKey, DataCacheItemVersion itemVersion, DataCacheOperations OperationId, DataCacheNotificationDescriptor nd)
    {
        //display some of the delegate parameters
        StringBuilder ResponseOfCache = new StringBuilder("A cache-level notification was triggered!");
        ResponseOfCache.Append("   ; Cache: " + myCacheName);
        ResponseOfCache.Append("   ; Region: " + myRegion);
        ResponseOfCache.Append("   ; Key: " + myKey);
        ResponseOfCache.Append("   ; Operation: " + OperationId.ToString());
        string value = ManualDataCacheOperations.GetCacheValue(myTestCache, txtKey.Text).ToString();
        Legend.Append(string.Format("{0} - Operation {1} Performed at {2}{3}", myKey, OperationId.ToString(), DateTime.Now.ToShortTimeString(), Environment.NewLine));

    }

Please let me know Where am I missing it?? Why is it sending multiple notifications for same item. If it is of any use, I am using a cluster with two hosts. And using same cache for session management too.

有帮助吗?

解决方案

First, be sure that you added only one callback. It's simple but i've seen too much cases where multiple callbacks were added.

It's really important to understand that cache notifications are based on polling.

When you use cache notifications, your application checks with the cache cluster at a regular interval (pollInterval) to see if any new notifications are available.

So, if you update 10 times a key between two checks, you will get 10 notifications.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top