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
{{ message }}
This repository was archived by the owner on Oct 23, 2023. It is now read-only.
Add an Akka Stream Sink graph stage for Kinesis. (#47)
Add a `KinesisSinkGraphStage` that uses an underlying `KinesisProducerActor` to do the heavy lifting. The stream manages back pressure by allowing only a fixed number of outstanding messages. A materialized value is used to indicate when a stream has been finished (or failed).
Copy file name to clipboardExpand all lines: README.md
+50Lines changed: 50 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -23,6 +23,7 @@ It's worth familiarising yourself with [Sequence numbers and Sub sequence number
23
23
*[Usage: Producer](#usage-usage-producer)
24
24
*[Actor Based Implementation](#usage-usage-producer-actor-based-implementation)
25
25
*[Pure Scala based implementation (simple wrapper around KPL)](#usage-usage-producer-pure-scala-based-implementation-simple-wrapper-around-kpl)
26
+
*[Akka Stream Sink](#akka-stream-sink)
26
27
*[Running the reliability test](#running-the-reliability-test)
27
28
*[Delete & recreate kinesisstreams and dynamo table](#running-the-reliability-test-delete-recreate-kinesisstreams-and-dynamo-table)
28
29
*[Running the producer-consumer test](#running-the-reliability-test-running-the-producer-consumer-test)
@@ -484,6 +485,55 @@ callback onFailure {
484
485
}
485
486
```
486
487
488
+
<aname="akka-stream-sink"></a>
489
+
### Akka Stream Sink
490
+
491
+
An Akka `Sink` is provided which can be used to publish messages via streams.
492
+
Every message is sent as `ProduserEvent` to the `Sink`, which defines the PartitionKey as well as the payload.
493
+
The `Sink` is created from a `ProducerConf` or directly with a `KinesisProducerActor`. See [Kinesis](https://github.com/WW-Digital/reactive-kinesis/blob/master/src/main/scala/com/weightwatchers/reactive/kinesis/stream/Kinesis.scala) for the various options.
494
+
495
+
The `Sink` expects an acknowledgement for every message sent to Kinesis.
496
+
An amount of unacknowledged messages can be configured, before back pressure is applied.
497
+
This throttling is controlled by the kinesis.{producer}.akka.max-outstanding-requests configuration value.
498
+
Please note: a default value (1000 messages) is applied, if throttling is not configured.
499
+
500
+
The provided `Sink` produces a `Future[Done]` as materialized value.
501
+
This future succeeds, if all messages from upstream are sent to Kinesis and acknowledged.
502
+
It fails if a message could not be send to Kinesis or upstream fails.
* Create a Sink that accepts ProducerEvents, which get published to Kinesis.
80
+
*
81
+
* The sink itself sends all events to an actor, which is created with the given Props.
82
+
* Every message send needs to be acknowledged by the underlying producer actor.
83
+
*
84
+
* This sink signals back pressure, if more than maxOutstanding messages are not acknowledged.
85
+
*
86
+
* The sink produces a materialized value `Future[Done]`, which is finished if all messages of the stream are send to the producer actor _and_ got acknowledged.
87
+
* The future fails, if the sending an event fails or upstream has failed the stream.
88
+
*
89
+
* @paramprops the props to create a producer actor. This is a function to work around #48.
90
+
* @parammaxOutStanding the number of messages to send to the actor unacknowledged before back pressure is applied.
* Create a Sink that accepts ProducerEvents, which get published to Kinesis.
102
+
*
103
+
* The sink itself sends all events to an KinesisProducerActor which is configured with given config object.
104
+
* Every message send needs to be acknowledged by the underlying producer actor.
105
+
*
106
+
* This sink signals back pressure, if more messages than configured in throttling conf are not acknowledged.
107
+
* If throttling is not configured, a default value (= 1000 messages) is applied.
108
+
*
109
+
* The sink produces a materialized value `Future[Done]`, which is finished if all messages of the stream are send to the producer actor _and_ got acknowledged.
110
+
* The future fails, if the sending an event fails or upstream has failed the stream.
111
+
*
112
+
* @paramproducerConf the configuration to create KinesisProducerActor
* Create a Sink that accepts ProducerEvents, which get published to Kinesis.
130
+
*
131
+
* The sink itself sends all events to an KinesisProducerActor which is configured from the system configuration for given producer name.
132
+
* Every message send needs to be acknowledged by the underlying producer actor.
133
+
*
134
+
* This sink signals back pressure, if more messages than configured in throttling conf are not acknowledged.
135
+
* If throttling is not configured, a default value (= 1000 messages) is applied.
136
+
*
137
+
* The sink produces a materialized value `Future[Done]`, which is finished if all messages of the stream are send to the producer actor _and_ got acknowledged.
138
+
* The future fails, if the sending an event fails or upstream has failed the stream.
139
+
*
140
+
* @paramkinesisConfig the configuration object that holds the producer config.
141
+
* @paramproducerName the name of the producer in the system configuration.
142
+
* @paramcredentialsProvider the AWS credentials provider to use to connect.
* Create a Sink that accepts ProducerEvents, which get published to Kinesis.
158
+
*
159
+
* The sink itself sends all events to an KinesisProducerActor which is configured from the system configuration for given producer name.
160
+
* Every message send needs to be acknowledged by the underlying producer actor.
161
+
*
162
+
* This sink signals back pressure, if more messages than configured in throttling conf are not acknowledged.
163
+
* If throttling is not configured, a default value (= 1000 messages) is applied.
164
+
*
165
+
* The sink produces a materialized value `Future[Done]`, which is finished if all messages of the stream are send to the producer actor _and_ got acknowledged.
166
+
* The future fails, if the sending an event fails or upstream has failed the stream.
167
+
*
168
+
* A minimal application conf file should look like this:
169
+
* {{{
170
+
* kinesis {
171
+
* application-name = "SampleService"
172
+
* producer-name {
173
+
* stream-name = "sample-stream"
174
+
* akka.max-outstanding-requests = 100
175
+
* }
176
+
* }
177
+
* }}}
178
+
* See kinesis reference.conf for a list of all available config options.
179
+
*
180
+
* @paramproducerName the name of the producer in the system configuration.
181
+
* @paraminConfig the configuration object that holds the producer config (usually kinesis).
182
+
* @paramcredentialsProvider the AWS credentials provider to use to connect.
0 commit comments