Cadence with timers
As the name suggests, the Cadence pattern defines a rhythm to perform certain operations. For example, certain applications may want to persist the state at a defined interval rather than writing to the persistent store with every state change, but here the trade-off is latency versus acceptable staleness.
For example, in our Distel
application, we may want to count and analyze the number of users or partners querying a specific hotel during a campaign. The participants in the Cadence pattern are Source (for example, HotelGrain
) and the Target (for example, CampaignGrain
) and there will be a timer registered to send updates from the Source Grain to the Target Grain at the set cadence, as shown in the following diagram:
Build the Cadence pattern by following the next steps:
- Define the target grain interface and implement it as shown in the following code snippet:
public interface ICampaignGrain...