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
Copy file name to clipboardExpand all lines: README.md
+31-17Lines changed: 31 additions & 17 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -16,7 +16,7 @@ The goal of this Spring Boot starter is to simplify the reliable integration bet
16
16
17
17
There are already [multiple clients for the Nakadi REST API](https://zalando.github.io/nakadi/manual.html#using_clients), but none of them solves the mentioned issues.
18
18
19
-
We solved them by persisting new events in a log table as part of the producing JDBC transaction. They will then be sent asynchonously to Nakadi after the transaction completed. If the transaction is rolled back, the events will vanish too. As a result, events will always be sent if and only if the transaction succeeded.
19
+
We solved them by persisting new events in a log table as part of the producing JDBC transaction. They will then be sent asynchronously to Nakadi after the transaction completed. If the transaction is rolled back, the events will vanish too. As a result, events will always be sent if and only if the transaction succeeded.
20
20
21
21
The Transmitter generates a strictly monotonically increasing event id that can be used for ordering the events during retrieval. It is not guaranteed, that events will be sent to Nakadi in the order they have been produced. If an event could not be sent to Nakadi, the library will periodically retry the transmission.
22
22
@@ -40,7 +40,8 @@ You may of course always setup a fresh system with the newest version.
40
40
41
41
## Prerequisites
42
42
43
-
This library was tested with Spring Boot 1.5.3.RELEASE and relies on an existing configured PostgreSQL DataSource.
43
+
This library was tested with Spring Boot 2.0.3.RELEASE and relies on an existing configured PostgreSQL DataSource.
44
+
**If you are still using Spring Boot 1.x, please use versions < 20.0.0, they are still actively maintained ([Documentation](https://github.com/zalando-nakadi/nakadi-producer-spring-boot-starter/tree/spring-boot-1)).**
* Please note that [tokens-spring-boot-starter](https://github.com/zalando-stups/spring-boot-zalando-stups-tokens) 0.10.0 comes with tokens 0.9.9, which is not enough. You can manually add tokens 0.10.0 with that starter, though.
54
+
* Please note that [tokens-spring-boot-starter](https://github.com/zalando-stups/spring-boot-zalando-stups-tokens) 0.10.0 comes with tokens 0.9.9, which is not enough. You can manually add tokens 0.10.0 with that starter, though. To be used in zalando's k8s environment, you must at least use 0.11.0.
54
55
55
56
56
57
## Usage
57
58
58
59
### Setup
59
60
60
-
If you are using maven, include the library in your `pom.xml`:
61
+
If you are using Maven, include the library in your `pom.xml`:
61
62
62
63
```xml
63
64
<dependency>
@@ -81,7 +82,7 @@ public class Application {
81
82
}
82
83
```
83
84
84
-
The library uses flyway migrations to set up its own database schema `nakadi_events`.
85
+
The library uses Flyway migrations to set up its own database schema `nakadi_events`.
85
86
86
87
### Nakadi communication configuration
87
88
@@ -211,30 +212,43 @@ process step the event is reporting.
211
212
### Event snapshots (optional)
212
213
213
214
A Snapshot event is a special type of data change event (data operation) defined by Nakadi.
214
-
It does not represent a change of the state of a resource, but a current snapshot of the state of the resource.
215
+
It does not represent a change of the state of a resource, but a current snapshot of its state. It can be useful to
216
+
bootstrap a new consumer or to recover from inconsistencies between sender and consumer after an incident.
215
217
216
218
You can create snapshot events programmatically (using EventLogWriter.fireSnapshotEvent), but usually snapshot event
217
219
creation is a irregular, manually triggered maintenance task.
218
220
219
221
This library provides a Spring Boot Actuator endpoint named `snapshot_event_creation` that can be used to trigger a Snapshot for a given event type. Assuming your management port is set to `7979`,
220
222
221
-
GET localhost:7979/snapshot_event_creation
223
+
GET localhost:7979/actuator/snapshot-event-creation
222
224
223
225
will return a list of all event types available for snapshot creation and
224
226
225
-
POST localhost:7979/snapshot_event_creation/my.event-type
227
+
POST localhost:7979/actuator/snapshot-event-creation/my.event-type
226
228
227
-
will trigger a snapshot for the event type `my.event-type`. The (optional) request body is a "filter specifier".
229
+
will trigger a snapshot for the event type `my.event-type`. You can change the port, the authentication scheme and the
230
+
path prefix as part of your Spring Boot Actuator configuration.
228
231
229
-
This will only work if your application has configured spring-boot-actuator
232
+
You can provide an optional filter specifier that will be passed to your application to implement any application
233
+
specific event/entity filtering logic. It can be provided either as a query parameter called `filter`, or as a
234
+
request body
235
+
236
+
{"filter":"myFilter"}
237
+
238
+
This endpoint will only work if your application includes spring-boot-actuator,
and if one or more Spring Beans implement the `org.zalando.nakadiproducer.snapshots.SnapshotEventGenerator` interface. Otherwise (or if the generator is not for the event type you requested), the library will respond with an error message when you request a snapshot creation.
237
-
The request body (the "filter specifier") of the trigger request will be passed as a string parameter to the SnapshotEventGenerator's `generateSnapshots` method.
0 commit comments