Package com.hazelcast.jet.pipeline
Class FileSinkBuilder<T>
java.lang.Object
com.hazelcast.jet.pipeline.FileSinkBuilder<T>
- Type Parameters:
T
- type of the items the sink accepts
- Since:
- Jet 3.0
-
Field Summary
Modifier and TypeFieldDescriptionstatic final long
A value to pass torollByFileSize(long)
if you want to disable rolling by file size.static final String
A suffix added to file names until they are committed. -
Method Summary
Modifier and TypeMethodDescriptionbuild()
Creates and returns the fileSink
with the supplied components.Sets the character set used to encode the files.exactlyOnce
(boolean enable) Enables or disables the exactly-once behavior of the sink using two-phase commit of state snapshots.rollByDate
(String datePattern) Sets a date pattern that will be included in the file name.rollByFileSize
(long maxFileSize) Enables rolling by file size.toStringFn
(FunctionEx<? super T, String> toStringFn) Sets the function which converts the item to its string representation.
-
Field Details
-
TEMP_FILE_SUFFIX
A suffix added to file names until they are committed. Files ending with this suffix should be ignored when processing. SeeSinks.filesBuilder(java.lang.String)
for more information.- See Also:
-
DISABLE_ROLLING
public static final long DISABLE_ROLLINGA value to pass torollByFileSize(long)
if you want to disable rolling by file size.- See Also:
-
-
Method Details
-
toStringFn
Sets the function which converts the item to its string representation. Each item is followed with a platform-specific line separator. Default value isObject.toString()
.The given function must be stateless and cooperative.
-
charset
Sets the character set used to encode the files. Default value isStandardCharsets.UTF_8
. -
rollByDate
Sets a date pattern that will be included in the file name. Each time the formatted current time changes a new file will be started. For example, if thedatePattern
isyyyy-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.
- Since:
- Jet 4.0
-
rollByFileSize
Enables rolling by file size. If the size after writing a batch of items exceeds the limit, a new file will be started. From this follows that the file will typically be larger than the given maximum.To disable rolling after certain size, pass
DISABLE_ROLLING
. This is the default value.- Since:
- Jet 4.0
-
exactlyOnce
Enables or disables the exactly-once behavior of the sink using two-phase commit of state snapshots. If enabled, the processing guarantee of the job must be set to exactly-once, otherwise the sink's guarantee will match that of the job. In other words, sink's guarantee cannot be higher than job's, but can be lower to avoid the additional overhead.See
Sinks.filesBuilder(String)
for more information.The default value is true.
- Parameters:
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-once- Returns:
- this instance for fluent API
- Since:
- Jet 4.0
-
build
Creates and returns the fileSink
with the supplied components.
-