Package com.hazelcast.jet.s3
Class S3Sinks
java.lang.Object
com.hazelcast.jet.s3.S3Sinks
Contains factory methods for creating AWS S3 sinks.
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T> Sink<? super T>
s3
(String bucketName, SupplierEx<? extends software.amazon.awssdk.services.s3.S3Client> clientSupplier) Convenience fors3(String, String, Charset, SupplierEx, FunctionEx)
UsesObject.toString()
to convert the items to lines.static <T> Sink<? super T>
s3
(String bucketName, String prefix, Charset charset, SupplierEx<? extends software.amazon.awssdk.services.s3.S3Client> clientSupplier, FunctionEx<? super T, String> toStringFn) Creates an AWS S3Sink
which writes items to files into the given bucket.
-
Method Details
-
s3
@Nonnull public static <T> Sink<? super T> s3(@Nonnull String bucketName, @Nonnull SupplierEx<? extends software.amazon.awssdk.services.s3.S3Client> clientSupplier) Convenience fors3(String, String, Charset, SupplierEx, FunctionEx)
UsesObject.toString()
to convert the items to lines. -
s3
@Nonnull public static <T> Sink<? super T> s3(@Nonnull String bucketName, @Nullable String prefix, @Nonnull Charset charset, @Nonnull SupplierEx<? extends software.amazon.awssdk.services.s3.S3Client> clientSupplier, @Nonnull FunctionEx<? super T, String> toStringFn) Creates an AWS S3Sink
which writes items to files into the given bucket. Sink converts each item to string using giventoStringFn
and writes it as a line. The sink creates a file in the bucket for each processor instance. Name of the file will include an user provided prefix (if defined) and processor's global index, for example the processor having the index 2 with prefixmy-object-
will create the objectmy-object-2
.No state is saved to snapshot for this sink. If the job is restarted previously written files will be overwritten.
The default local parallelism for this sink is 1.
Here is an example which reads from a map and writes the entries to given bucket using
Object.toString()
to convert the values to a line.Pipeline p = Pipeline.create(); p.readFrom(Sources.map("map")) .writeTo(S3Sinks.s3("bucket", "my-map-", StandardCharsets.UTF_8, () -> S3Client.create(), Object::toString ));
- Type Parameters:
T
- type of the items the sink accepts- Parameters:
bucketName
- the name of the bucketprefix
- the prefix to be included in the file namecharset
- the charset to be used when encoding the stringsclientSupplier
- S3 client suppliertoStringFn
- the function which converts each item to its string representation
-