Trending on MSDN: Multiple Service Fabric Reliable Dictionary Notifications

Micah McKittrick 946 Reputation points Microsoft Employee
2019-10-29T19:41:45.527+00:00

I have stateful service fabric service where the replica count is 3. In this stateful service, I have a reliable dictionary. I want to track notifications for each CRUD operation which is performed on the reliable dictionary.

I have followed the link to integrate reliable dictionary notifications

If I use a one-node cluster and replica count is 1, I will be getting one notification for each operation (Create, Update, Delete). But If I use five-node cluster and replica count is 3, I will be getting three notifications for each operation, which is causing duplicate records in my business logic, I need only one notification for each operation.

My expectation is to get a notification for each replica when the dictionary has been updated.

Can anyone help me out to resolve this issue?

Sourced from MSDN

Azure Service Fabric
Azure Service Fabric
An Azure service that is used to develop microservices and orchestrate containers on Windows and Linux.
252 questions
0 comments No comments
{count} votes

Accepted answer
  1. olufemia-MSFT 2,861 Reputation points
    2019-10-29T23:11:44.87+00:00

    Welcome to the Microsoft Q&A (Preview) platform. Happy to answer your questions.

    Currently, notifications fire on all replicas when the changes show up.
    This means in your code, you can either

    1. Not hook up the notifications on secondary replicas or unhook the notifications when the replicas become secondaries (and rehook them when becoming primary)
    2. Discard the notifications that fire on the secondaries Both would require adding an override to OnChangeRoleAsync

    You can follow this document for more information.

    Sourced from MSDN

    0 comments No comments

2 additional answers

Sort by: Most helpful
  1. AHMED ISMAIL GOMAA BAKIR 906 Reputation points
    2022-05-05T22:01:15.817+00:00

    Not hook up the notifications on secondary replicas or unhook the notifications when the replicas become secondaries (and rehook them when becoming primary)

    Discard the notifications that fire on the secondaries Both would require adding an override to OnChangeRoleAsync

    You can follow this document for more information.

    7 people found this answer helpful.
    0 comments No comments

  2. Hanan Ali Ibrahem Roffa 81 Reputation points
    2022-05-06T03:16:52.58+00:00

    Not hook up the notifications on secondary replicas or unhook the notifications when the replicas become secondaries (and rehook them when becoming primary) Discard the notifications that fire on the secondaries Both would require adding an override to OnChangeRoleAsync You can follow this document for more information.

    0 comments No comments