fs2-aws
FS2 streaming wrappers for the AWS SDK v2 clients. Each fs2-aws-* module adds a streaming API
on top of a pure-aws client, so you can read, write and consume AWS services as
back-pressured Streams and Pipes.
These docs are for the 7.x release; the older 6.x docs are here.
How the modules are built
Every AWS service has two layers:
- Generated algebra (
pure-aws). Each SDK async client becomes a tagless-final algebra, e.g.SqsAsyncClientOp[F]. EveryCompletableFuture-returning method becomes anF-returning method, and an interpreter manages the client as aResource. The algebra is generated from the SDK, so it tracks each SDK release. - Streaming algebra (
fs2-aws). A hand-written module wraps the generated algebra and exposes the operations that suit streams, such as aPipethat publishes a stream of messages or aStreamthat reads an object. The module's algebra is named after the service, e.g.S3[F],SQS[F],SNS[F].
The streaming algebra is built with a create factory that takes the generated algebra, e.g.
SQS.create[IO](config, sqsOp), so you control the client lifecycle. fs2-aws-kinesis is the
exception: it takes the SDK clients for the Kinesis Client Library.
Modules
| Module | Streaming algebra | Built on |
|---|---|---|
fs2-aws-s3 |
S3[F] |
pure-s3-tagless |
fs2-aws-sqs |
SQS[F] |
pure-sqs-tagless |
fs2-aws-sns |
SNS[F] |
pure-sns-tagless, pure-sqs-tagless |
fs2-aws-kinesis |
Kinesis[F] |
pure-kinesis-tagless, pure-dynamodb-tagless, pure-cloudwatch-tagless |
fs2-aws-dynamodb |
StreamScan[F] |
pure-dynamodb-tagless |
fs2-aws-testkit |
test doubles for the Kinesis consumer and producer | fs2-aws-kinesis |
The underlying clients are documented on the pure-aws page, including the
interpreters and the clientResource option for passing your own SDK client builder.
Import
Add the module you need. Each module pulls in its pure-* dependency transitively:
libraryDependencies += "io.laserdisc" %% "fs2-aws-s3" % "6.6.0"
Testing
Each streaming module calls a tagless-final algebra from pure-aws, and each of those
pure modules publishes a tests jar with a Mock…AsyncClientOp stub. Add the stub as a test dependency
and override the calls your code makes. fs2-aws-kinesis is the exception: use
fs2-aws-testkit. See each module's page for an example.