use of org.apache.kafka.connect.errors.ConnectException in project ignite by apache.
the class IgniteSinkConnector method start.
/**
* A sink lifecycle method. Validates grid-specific sink properties.
*
* @param props Sink properties.
*/
@Override
public void start(Map<String, String> props) {
configProps = props;
try {
A.notNullOrEmpty(configProps.get(SinkConnector.TOPICS_CONFIG), "topics");
A.notNullOrEmpty(configProps.get(IgniteSinkConstants.CACHE_NAME), "cache name");
A.notNullOrEmpty(configProps.get(IgniteSinkConstants.CACHE_CFG_PATH), "path to cache config file");
} catch (IllegalArgumentException e) {
throw new ConnectException("Cannot start IgniteSinkConnector due to configuration error", e);
}
}
use of org.apache.kafka.connect.errors.ConnectException 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