Created
July 31, 2017 17:12
-
-
Save bszwej/a5536edf832538da5e39a916008f549e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Source.fromPublisher(collection.find(): Publisher[org.bson.Document]) | |
.map((doc: org.bson.Document) ⇒ doc.toJson()) | |
.map((json: String) ⇒ ByteString(json)) | |
.via(Compression.gzip: Flow[ByteString, ByteString, NotUsed]) | |
.runWith(s3Sink) | |
val s3Sink: Sink[ByteString, Future[MultipartUploadResult]] = | |
s3Client.multipartUploadWithHeaders( | |
bucket = "mycookiesbucket12345", | |
key = "CookieCollectionBackup.json", | |
s3Headers = Some(S3Headers(ServerSideEncryption.AES256)) | |
) | |
The full runnable code can be found here: | |
https://github.com/bszwej/mongodb-s3-stream-example |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment