IN
- Type of the elements emitted by this sinkpublic abstract class CassandraSinkBase<IN,V> extends RichSinkFunction<IN> implements CheckpointedFunction
CassandraPojoSink
and CassandraTupleSink
.SinkFunction.Context<T>
Modifier and Type | Field and Description |
---|---|
protected com.datastax.driver.core.Cluster |
cluster |
protected org.slf4j.Logger |
log |
protected com.datastax.driver.core.Session |
session |
Modifier and Type | Method and Description |
---|---|
void |
close()
Tear-down method for the user code.
|
protected com.datastax.driver.core.Session |
createSession() |
void |
initializeState(FunctionInitializationContext context)
This method is called when the parallel function instance is created during distributed
execution.
|
void |
invoke(IN value) |
void |
open(Configuration configuration)
Initialization method for the function.
|
abstract com.google.common.util.concurrent.ListenableFuture<V> |
send(IN value) |
void |
snapshotState(FunctionSnapshotContext ctx)
This method is called when a snapshot for a checkpoint is requested.
|
getIterationRuntimeContext, getRuntimeContext, setRuntimeContext
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
invoke
protected final org.slf4j.Logger log
protected transient com.datastax.driver.core.Cluster cluster
protected transient com.datastax.driver.core.Session session
public void open(Configuration configuration)
RichFunction
The configuration object passed to the function can be used for configuration and initialization. The configuration contains all parameters that were configured on the function in the program composition.
public class MyMapper extends FilterFunction<String> {
private String searchString;
public void open(Configuration parameters) {
this.searchString = parameters.getString("foo");
}
public boolean filter(String value) {
return value.equals(searchString);
}
}
By default, this method does nothing.
open
in interface RichFunction
open
in class AbstractRichFunction
configuration
- The configuration containing the parameters attached to the contract.Configuration
public void close() throws Exception
RichFunction
This method can be used for clean up work.
close
in interface RichFunction
close
in class AbstractRichFunction
Exception
- Implementations may forward exceptions, which are caught by the runtime. When the
runtime catches an exception, it aborts the task and lets the fail-over logic
decide whether to retry the task execution.public void initializeState(FunctionInitializationContext context) throws Exception
CheckpointedFunction
initializeState
in interface CheckpointedFunction
context
- the context for initializing the operatorException
public void snapshotState(FunctionSnapshotContext ctx) throws Exception
CheckpointedFunction
FunctionInitializationContext
when
the Function was initialized, or offered now by FunctionSnapshotContext
itself.snapshotState
in interface CheckpointedFunction
ctx
- the context for drawing a snapshot of the operatorException
public void invoke(IN value) throws Exception
invoke
in interface SinkFunction<IN>
Exception
protected com.datastax.driver.core.Session createSession()
Copyright © 2014–2020 The Apache Software Foundation. All rights reserved.