You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
*Note that according to the CloudEvents standard, event IDs must be of type string.*
88
+
89
+
### Reading Events
90
+
91
+
To read all events of a subject, call the `readEvents` function with the subject as the first argument and an options object as the second argument. Set the `recursive` option to `false`. This ensures that only events of the given subject are returned, not events of nested subjects.
92
+
93
+
The function returns an asynchronous iterator, which you can use e.g. inside a `for await` loop:
This also allows you to read *all* events ever written. To do so, provide `/` as the subject and set `recursive` to `true`, since all subjects are nested under the root subject.
116
+
117
+
#### Reading in Anti-Chronological Order
118
+
119
+
By default, events are read in chronological order. To read in anti-chronological order, provide the `order` option and set it to `antichronological`:
*Note that you can also specify `chronological` to explicitly enforce the default order.*
131
+
132
+
#### Specifying Bounds
133
+
134
+
Sometimes you do not want to read all events, but only a range of events. For that, you can specify the `lowerBound` and `upperBound` options – either one of them or even both at the same time.
135
+
136
+
Specify the ID and whether to include or exclude it, for both the lower and upper bound:
#### Starting From the Latest Event of a Given Type
149
+
150
+
To read starting from the latest event of a given type, provide the `fromLatestEvent` option and specify the subject, the type, and how to proceed if no such event exists.
151
+
152
+
Possible options are `read-nothing`, which skips reading entirely, or `read-everything`, which effectively behaves as if `fromLatestEvent` was not specified:
0 commit comments