|
10 | 10 | - [Error suppression](#error-suppression) |
11 | 11 | - [Follower operation](#follower-operation) |
12 | 12 | - [Checkpoints](#checkpoints) |
| 13 | + * [Checkpointing filtered changes](#checkpointing-filtered-changes) |
13 | 14 | - [Code examples](#code-examples) |
14 | 15 | * [Initializing a changes follower](#initializing-a-changes-follower) |
15 | 16 | * [Starting the changes follower](#starting-the-changes-follower) |
@@ -127,6 +128,24 @@ but the tradeoff is repeating more changes if it is necessary to resume the chan |
127 | 128 | Take extreme care persisting sequences if choosing to process change items in parallel as there |
128 | 129 | is a considerable risk of missing changes on a restart if the recorded sequence is out of order. |
129 | 130 |
|
| 131 | +### Checkpointing filtered changes |
| 132 | + |
| 133 | +With highly filtered changes feeds, multiple pages can pass through the follower without returning any |
| 134 | +change items. Using only the sequence ID of the last processed change item in those cases causes a long |
| 135 | +changes feed rewind on the next run. |
| 136 | + |
| 137 | +To avoid this, periodically get the latest sequence from the follower. |
| 138 | +Supply the last fully processed sequence ID or a previously returned sequence value, |
| 139 | +and persist the returned value to use as the `since` parameter when restarting the follower. |
| 140 | + |
| 141 | +```python |
| 142 | +latest_seq = changes_follower.latest_sequence_from(checkpoint_sequence_id) |
| 143 | +``` |
| 144 | + |
| 145 | +The follower retains a bounded window of recent sequence IDs. If subsequent page fetches displace |
| 146 | +the supplied sequence ID from that window, the follower returns the supplied value unchanged. |
| 147 | +Call and persist the result regularly to obtain a fresh sequence ID. |
| 148 | + |
130 | 149 | ## Code examples |
131 | 150 |
|
132 | 151 | ### Initializing a changes follower |
|
0 commit comments