gnodet-bot commented on code in PR #29840:
URL: https://github.com/apache/camel/pull/29840#discussion_r4597515115
##########
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:
⚠️ **AsciiDoc tab structure broken — Java tab is empty**
The `----` fence that opens the `Java::` tab (this line) has no content
before `YAML::` begins. The Java example appears after the `====` closing
delimiter (lines 797–803), orphaned as plain text outside the tabs block. The
trailing `----` is a dangling delimiter.
Move the Java content inside the tab:
```suggestion
----
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();
----
YAML::
+
[source,yaml]
----
- route:
from:
uri: openfga:readChanges
parameters:
storeId: "{{fga.store}}"
type: document
checkpointRepository: "#changeCheckpoints"
checkpointKey: documents-projection-v1
pageSize: 100
delay: 1000
changePollTimeout: 30000
steps:
- split:
expression:
simple: "${body}"
shareUnitOfWork: true
stopOnException: true
steps:
- to: direct:applyChange
----
====
```
--
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]