T- type of emitted objects
public final class SourceBuilder.Batch<T> extends Object
|Modifier and Type||Method and Description|
Builds and returns the batch source.
Sets the function that Jet will call when it is done cleaning up after an execution.
Declares that you're creating a distributed source.
Sets the function that Jet will call whenever it needs more data from your source.
Sets the the permission required to use this sink when the security is enabled.
@Nonnull public <T_NEW> SourceBuilder.Batch<T_NEW> fillBufferFn(@Nonnull BiConsumerEx<? super C,? super SourceBuilder.SourceBuffer<T_NEW>> fillBufferFn)
createFnand Jet's buffer object. It should add some items to the buffer, ideally those it can produce without making any blocking calls. On any given invocation the function may also choose not to add any items. Jet will automatically employ an exponential backoff strategy to avoid calling your function in a tight loop, if the previous call didn't add any items to the buffer.
SourceBuilder.SourceBuffer isn't thread-safe, you shouldn't pass
it to other threads. For example, you shouldn't add to it in a
callback of an asynchronous operation.
Once it has emitted all the data, the function must call
T_NEW- type of the emitted items
fillBufferFn- function that fills the buffer with source data. It must be stateless.
@Nonnull public SourceBuilder.Batch<T> destroyFn(@Nonnull ConsumerEx<? super C> destroyFn)
The function must be stateless.
@Nonnull public SourceBuilder.Batch<T> distributed(int preferredLocalParallelism)
preferredLocalParallelismparameter. If you call this, you must ensure that all the source processors are coordinated and not emitting duplicated data. The
Processor.Context#globalProcessorIndex(). Jet calls
createFnexactly once with each
globalProcessorIndexfrom 0 to
totalParallelism - 1and you can use this to make all the instances agree on which part of the data to emit.
If you don't call this method, there will be only one processor instance running on an arbitrary member.
preferredLocalParallelism- the requested number of processors on each cluster member
public SourceBuilder.Batch<T> permission(@Nonnull Permission permission)
nullwhich means there is no restriction to use this sink. Security is an enterprise feature.
permission- the required permission to use this sink when security is enabled.
@Nonnull public BatchSource<T> build()
Copyright © 2021 Hazelcast, Inc.. All rights reserved.