use of org.apache.ignite.stream.StreamSingleTupleExtractor in project ignite by apache.
the class IgniteSinkTask method start.
/**
* Initializes grid client from configPath.
*
* @param props Task properties.
*/
@Override
public void start(Map<String, String> props) {
// Each task has the same parameters -- avoid setting more than once.
if (cacheName != null)
return;
cacheName = props.get(IgniteSinkConstants.CACHE_NAME);
igniteConfigFile = props.get(IgniteSinkConstants.CACHE_CFG_PATH);
if (props.containsKey(IgniteSinkConstants.CACHE_ALLOW_OVERWRITE))
StreamerContext.getStreamer().allowOverwrite(Boolean.parseBoolean(props.get(IgniteSinkConstants.CACHE_ALLOW_OVERWRITE)));
if (props.containsKey(IgniteSinkConstants.CACHE_PER_NODE_DATA_SIZE))
StreamerContext.getStreamer().perNodeBufferSize(Integer.parseInt(props.get(IgniteSinkConstants.CACHE_PER_NODE_DATA_SIZE)));
if (props.containsKey(IgniteSinkConstants.CACHE_PER_NODE_PAR_OPS))
StreamerContext.getStreamer().perNodeParallelOperations(Integer.parseInt(props.get(IgniteSinkConstants.CACHE_PER_NODE_PAR_OPS)));
if (props.containsKey(IgniteSinkConstants.SINGLE_TUPLE_EXTRACTOR_CLASS)) {
String transformerCls = props.get(IgniteSinkConstants.SINGLE_TUPLE_EXTRACTOR_CLASS);
if (transformerCls != null && !transformerCls.isEmpty()) {
try {
Class<? extends StreamSingleTupleExtractor> clazz = (Class<? extends StreamSingleTupleExtractor<SinkRecord, Object, Object>>) Class.forName(transformerCls);
extractor = clazz.newInstance();
} catch (Exception e) {
throw new ConnectException("Failed to instantiate the provided transformer!", e);
}
}
}
stopped = false;
}
Aggregations