davsclaus commented on code in PR #29840:
URL: https://github.com/apache/camel/pull/29840#discussion_r4602240942


##########
components/camel-openfga/src/main/docs/openfga-component.adoc:
##########
@@ -751,56 +751,109 @@ when the changed tuple has one.
 Both are paged. `pageSize` bounds one request, and the token the page returns 
arrives on
 `CamelOpenFgaContinuationToken`; feed it back through `continuationToken` to 
read on.
 
-A `readChanges` poller has to carry that token from one exchange to the 
*next*, which an exchange property cannot do:
-every timer fire is a new exchange, so a property left on the previous one is 
gone and each poll would start from the
-beginning again. Use a global variable, which outlives the exchange:
+=== Consuming the change log with durable checkpoints
+
+Only `readChanges` supports consumption. It polls one bounded page per 
scheduled
+poll and sends a `List<Map<String, Object>>` containing the changes, in server
+order, to the route. Configure `pageSize` to bound the requested page size; 
empty
+tail pages do not produce exchanges. Standard scheduled polling options, such 
as
+`delay`, `initialDelay` and polling backoff, control the schedule.
+
+Register an application-provided `org.apache.camel.spi.StateRepository<String, 
String>`
+as `changeCheckpoints`. Start it before the route and stop it after the route:
 
 [tabs]
 ====
 Java::
 +
 [source,java]
-------------------------------------------------------------
-from("timer:sync?period=30000")
-        .to("openfga:readChanges?storeId={{fga.store}}&type=document"
-            + "&continuationToken=${variable.global:fgaToken}")
-        .setVariable("global:fgaToken", 
header("CamelOpenFgaContinuationToken"))
-        .split(body()).to("direct:applyChange");
-------------------------------------------------------------
+----
 
 YAML::
 +
 [source,yaml]
 ----
 - route:
     from:
-      uri: timer:sync
+      uri: openfga:readChanges
       parameters:
-        period: 30000
+        storeId: "{{fga.store}}"
+        type: document
+        checkpointRepository: "#changeCheckpoints"
+        checkpointKey: documents-projection-v1
+        pageSize: 100
+        delay: 1000
+        changePollTimeout: 30000
       steps:
-        - to:
-            uri: openfga:readChanges
-            parameters:
-              storeId: "{{fga.store}}"
-              type: document
-              continuationToken: "${variable.global:fgaToken}"
-        - setVariable:
-            name: "global:fgaToken"
-            expression:
-              header:
-                expression: CamelOpenFgaContinuationToken
         - split:
             expression:
-              simple:
-                expression: "${body}"
+              simple: "${body}"
+            shareUnitOfWork: true
+            stopOnException: true
             steps:
-              - to:
-                  uri: direct:applyChange
+              - to: direct:applyChange
 ----
 ====
+from("openfga:readChanges?storeId={{fga.store}}&type=document"
+    + 
"&checkpointRepository=#changeCheckpoints&checkpointKey=documents-projection-v1"
+    + "&pageSize=100&delay=1000&changePollTimeout=30000")
+    .split(body()).shareUnitOfWork().stopOnException()
+        .to("direct:applyChange")
+    .end();
+----

Review Comment:
   The doc at the head (1ee2915f7e) does not have this problem: the readChanges 
consumer example is a plain `[source,java]` block under "Consuming the change 
log with durable checkpoints" (no tabs), and the `[tabs]` block under 
"Examples" holds only the `check` example, with its Java and YAML tabs and 
closing `====` in place. The orphaned Java lines in this thread come from how 
the diff interleaves the removed `timer:sync` example with the new lines, not 
from the file itself. Resolving.
   
   _Claude Code on behalf of Claus Ibsen (davsclaus)_



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to