T
- type of the items the sink acceptspublic final class FileSinkBuilder<T> extends Object
Modifier and Type | Field and Description |
---|---|
static long |
DISABLE_ROLLING
A value to pass to
rollByFileSize(long) if you want to
disable rolling by file size. |
static String |
TEMP_FILE_SUFFIX
A suffix added to file names until they are committed.
|
Modifier and Type | Method and Description |
---|---|
Sink<T> |
build()
Creates and returns the file
Sink with the supplied components. |
FileSinkBuilder<T> |
charset(Charset charset)
Sets the character set used to encode the files.
|
FileSinkBuilder<T> |
exactlyOnce(boolean enable)
Enables or disables the exactly-once behavior of the sink using
two-phase commit of state snapshots.
|
FileSinkBuilder<T> |
rollByDate(String datePattern)
Sets a date pattern that will be included in the file name.
|
FileSinkBuilder<T> |
rollByFileSize(long maxFileSize)
Enables rolling by file size.
|
FileSinkBuilder<T> |
toStringFn(FunctionEx<? super T,String> toStringFn)
Sets the function which converts the item to its string representation.
|
public static final String TEMP_FILE_SUFFIX
Sinks.filesBuilder(java.lang.String)
for more information.public static final long DISABLE_ROLLING
rollByFileSize(long)
if you want to
disable rolling by file size.@Nonnull public FileSinkBuilder<T> toStringFn(@Nonnull FunctionEx<? super T,String> toStringFn)
Object.toString()
.
The given function must be stateless and cooperative.
@Nonnull public FileSinkBuilder<T> charset(@Nonnull Charset charset)
StandardCharsets.UTF_8
.@Nonnull public FileSinkBuilder<T> rollByDate(@Nullable String datePattern)
datePattern
is yyyy-MM-dd
, a new file
will be started every day.
The rolling is based on system time, not on event time. By default no rolling by date is done. If the system clock goes back, the outcome is unspecified and possibly corrupt.
@Nonnull public FileSinkBuilder<T> rollByFileSize(long maxFileSize)
To disable rolling after certain size, pass DISABLE_ROLLING
. This is the default value.
@Nonnull public FileSinkBuilder<T> exactlyOnce(boolean enable)
See Sinks.filesBuilder(String)
for more information.
The default value is true.
enable
- If true, sink's guarantee will match the job guarantee.
If false, sink's guarantee will be at-least-once even if
job's is exactly-onceCopyright © 2023 Hazelcast, Inc.. All rights reserved.