Hello @Billy | IKANDA handling recurring events with subscriptions can indeed be tricky, especially when dealing with instances and updates. Let’s break down some strategies to address this challenge:
- Master Event vs. Instances:
- You’ve correctly observed that when working with recurring events, the subscription only returns the ID of the master event. This is because recurring events are essentially a series with a common pattern (the master event) and individual occurrences (instances).
- To handle instances, you’ll need to retrieve the master event and then use recurrence information (such as the recurrence pattern and range) to generate the instances yourself.
- You’ve correctly observed that when working with recurring events, the subscription only returns the ID of the master event. This is because recurring events are essentially a series with a common pattern (the master event) and individual occurrences (instances).
- Instance Retrieval:
- After receiving the master event ID, you can use the recurrence pattern (e.g., daily, weekly) and the start date to calculate the instances.
- For example, if the master event is a weekly meeting starting on Monday, you can calculate all the Mondays within the specified range to get the instances.
- After receiving the master event ID, you can use the recurrence pattern (e.g., daily, weekly) and the start date to calculate the instances.
- Tracking Updates:
- When an update occurs (e.g., an instance is modified), you’ll receive a notification for the master event. However, you won’t know which specific instance was updated.
- To handle this, maintain a mapping between the master event and its instances. When an update notification arrives, compare the updated master event with the instances to identify the affected instance(s).
- When an update occurs (e.g., an instance is modified), you’ll receive a notification for the master event. However, you won’t know which specific instance was updated.
- Deletion Notifications:
- Deleting an instance can indeed be challenging due to the notification behavior you described.
- One approach is to track deletions separately. When you receive a deletion notification for the entire series, mark the corresponding instance(s) as deleted.
- You can also use the
RecurrenceMasterId
property to link the deleted instance back to the master event.
- You can also use the
- One approach is to track deletions separately. When you receive a deletion notification for the entire series, mark the corresponding instance(s) as deleted.
- Deleting an instance can indeed be challenging due to the notification behavior you described.
- Granularity of Subscriptions:
- Consider the granularity of your subscriptions. You might need separate subscriptions for master events and instances.
- For instance updates, subscribe to changes on individual instances. For master event updates (e.g., recurrence pattern changes), subscribe to the master event.
- Consider the granularity of your subscriptions. You might need separate subscriptions for master events and instances.
- Testing and Edge Cases:
- Test thoroughly with various recurrence patterns (daily, weekly, monthly) and edge cases (e.g., exceptions, modified instances).
- Consider scenarios like exceptions (cancellations or modifications to specific instances) and how they affect the overall series.
- Test thoroughly with various recurrence patterns (daily, weekly, monthly) and edge cases (e.g., exceptions, modified instances).