use of org.apache.storm.utils.BatchHelper in project storm by apache.
the class HBaseBolt method prepare.
@Override
public void prepare(Map<String, Object> map, TopologyContext topologyContext, OutputCollector collector) {
super.prepare(map, topologyContext, collector);
this.batchHelper = new BatchHelper(batchSize, collector);
}
use of org.apache.storm.utils.BatchHelper in project storm by apache.
the class MongoInsertBolt method prepare.
@Override
public void prepare(Map<String, Object> topoConf, TopologyContext context, OutputCollector collector) {
super.prepare(topoConf, context, collector);
this.batchHelper = new BatchHelper(batchSize, collector);
}
use of org.apache.storm.utils.BatchHelper in project storm by apache.
the class HiveBolt method prepare.
@Override
public void prepare(Map conf, TopologyContext topologyContext, OutputCollector collector) {
try {
if (options.getKerberosPrincipal() == null && options.getKerberosKeytab() == null) {
kerberosEnabled = false;
} else if (options.getKerberosPrincipal() != null && options.getKerberosKeytab() != null) {
kerberosEnabled = true;
} else {
throw new IllegalArgumentException("To enable Kerberos, need to set both KerberosPrincipal " + " & KerberosKeytab");
}
if (kerberosEnabled) {
try {
ugi = HiveUtils.authenticate(options.getKerberosKeytab(), options.getKerberosPrincipal());
} catch (HiveUtils.AuthenticationFailed ex) {
LOG.error("Hive Kerberos authentication failed " + ex.getMessage(), ex);
throw new IllegalArgumentException(ex);
}
}
this.collector = collector;
this.batchHelper = new BatchHelper(options.getBatchSize(), collector);
allWriters = new ConcurrentHashMap<HiveEndPoint, HiveWriter>();
String timeoutName = "hive-bolt-%d";
this.callTimeoutPool = Executors.newFixedThreadPool(1, new ThreadFactoryBuilder().setNameFormat(timeoutName).build());
sendHeartBeat.set(true);
heartBeatTimer = new Timer();
setupHeartBeatTimer();
} catch (Exception e) {
LOG.warn("unable to make connection to hive ", e);
}
}
use of org.apache.storm.utils.BatchHelper in project storm by apache.
the class HiveBolt method prepare.
@Override
public void prepare(Map<String, Object> conf, TopologyContext topologyContext, OutputCollector collector) {
try {
tokenAuthEnabled = HiveUtils.isTokenAuthEnabled(conf);
try {
ugi = HiveUtils.authenticate(tokenAuthEnabled, options.getKerberosKeytab(), options.getKerberosPrincipal());
} catch (HiveUtils.AuthenticationFailed ex) {
LOG.error("Hive kerberos authentication failed " + ex.getMessage(), ex);
throw new IllegalArgumentException(ex);
}
this.collector = collector;
this.batchHelper = new BatchHelper(options.getBatchSize(), collector);
allWriters = new ConcurrentHashMap<HiveEndPoint, HiveWriter>();
String timeoutName = "hive-bolt-%d";
this.callTimeoutPool = Executors.newFixedThreadPool(1, new ThreadFactoryBuilder().setNameFormat(timeoutName).build());
sendHeartBeat.set(true);
heartBeatTimer = new Timer(topologyContext.getThisTaskId() + "-hb-timer", true);
setupHeartBeatTimer();
} catch (Exception e) {
LOG.warn("unable to make connection to hive ", e);
}
}
Aggregations