use of org.apache.rocketmq.remoting.RPCHook in project rocketmq-externals by apache.
the class HudiSinkConnector method startMQAdminTools.
private synchronized void startMQAdminTools() {
if (!configValid || adminStarted) {
return;
}
RPCHook rpcHook = null;
this.srcMQAdminExt = new DefaultMQAdminExt(rpcHook);
this.srcMQAdminExt.setNamesrvAddr(this.sinkConnectConfig.getSrcNamesrvs());
this.srcMQAdminExt.setAdminExtGroup(Utils.createGroupName(HUDI_CONNECTOR_ADMIN_PREFIX));
this.srcMQAdminExt.setInstanceName(Utils.createInstanceName(this.sinkConnectConfig.getSrcNamesrvs()));
try {
log.info("Trying to start srcMQAdminExt");
this.srcMQAdminExt.start();
log.info("RocketMQ srcMQAdminExt started");
} catch (MQClientException e) {
log.error("Hudi Sink Task start failed for `srcMQAdminExt` exception.", e);
}
adminStarted = true;
}
use of org.apache.rocketmq.remoting.RPCHook in project rocketmq-externals by apache.
the class JdbcSinkConnector method startMQAdminTools.
private synchronized void startMQAdminTools() {
if (!configValid || adminStarted) {
return;
}
RPCHook rpcHook = null;
this.srcMQAdminExt = new DefaultMQAdminExt(rpcHook);
this.srcMQAdminExt.setNamesrvAddr(((SinkDbConnectorConfig) this.dbConnectorConfig).getSrcNamesrvs());
this.srcMQAdminExt.setAdminExtGroup(Utils.createGroupName(ConstDefine.JDBC_CONNECTOR_ADMIN_PREFIX));
this.srcMQAdminExt.setInstanceName(Utils.createInstanceName(((SinkDbConnectorConfig) this.dbConnectorConfig).getSrcNamesrvs()));
try {
this.srcMQAdminExt.start();
log.info("RocketMQ srcMQAdminExt started");
} catch (MQClientException e) {
log.error("Replicator start failed for `srcMQAdminExt` exception.", e);
}
adminStarted = true;
}
use of org.apache.rocketmq.remoting.RPCHook in project rocketmq-externals by apache.
the class CassandraSinkConnector method startMQAdminTools.
private synchronized void startMQAdminTools() {
if (!configValid || adminStarted) {
return;
}
RPCHook rpcHook = null;
this.srcMQAdminExt = new DefaultMQAdminExt(rpcHook);
this.srcMQAdminExt.setNamesrvAddr(((SinkDbConnectorConfig) this.dbConnectorConfig).getSrcNamesrvs());
this.srcMQAdminExt.setAdminExtGroup(Utils.createGroupName(ConstDefine.CASSANDRA_CONNECTOR_ADMIN_PREFIX));
this.srcMQAdminExt.setInstanceName(Utils.createInstanceName(((SinkDbConnectorConfig) this.dbConnectorConfig).getSrcNamesrvs()));
try {
log.info("Trying to start srcMQAdminExt");
this.srcMQAdminExt.start();
log.info("RocketMQ srcMQAdminExt started");
} catch (MQClientException e) {
log.error("Cassandra Sink Task start failed for `srcMQAdminExt` exception.", e);
}
adminStarted = true;
}
use of org.apache.rocketmq.remoting.RPCHook in project rocketmq-externals by apache.
the class Utils method startTargetMQAdminTool.
public static DefaultMQAdminExt startTargetMQAdminTool(RmqConnectorConfig replicatorConfig) throws MQClientException {
RPCHook rpcHook = null;
if (replicatorConfig.isTargetAclEnable()) {
rpcHook = new AclClientRPCHook(new SessionCredentials(replicatorConfig.getTargetAccessKey(), replicatorConfig.getTargetSecretKey()));
}
DefaultMQAdminExt targetMQAdminExt = new DefaultMQAdminExt(rpcHook);
targetMQAdminExt.setNamesrvAddr(replicatorConfig.getTargetNamesrvs());
targetMQAdminExt.setAdminExtGroup(ConstDefine.REPLICATOR_ADMIN_GROUP);
targetMQAdminExt.setInstanceName(Utils.createUniqIntanceName(replicatorConfig.getTargetNamesrvs()));
targetMQAdminExt.start();
log.info("TARGET: RocketMQ targetMQAdminExt started.");
return targetMQAdminExt;
}
use of org.apache.rocketmq.remoting.RPCHook in project rocketmq-externals by apache.
the class ConnectUtil method initDefaultMQPullConsumer.
public static DefaultMQPullConsumer initDefaultMQPullConsumer(ConnectConfig connectConfig) {
RPCHook rpcHook = null;
if (connectConfig.getAclEnable()) {
rpcHook = new AclClientRPCHook(new SessionCredentials(connectConfig.getAccessKey(), connectConfig.getSecretKey()));
}
DefaultMQPullConsumer consumer = new DefaultMQPullConsumer(rpcHook);
consumer.setNamesrvAddr(connectConfig.getNamesrvAddr());
consumer.setInstanceName(createUniqInstance(connectConfig.getNamesrvAddr()));
consumer.setConsumerGroup(connectConfig.getRmqConsumerGroup());
consumer.setMaxReconsumeTimes(connectConfig.getRmqMaxRedeliveryTimes());
consumer.setBrokerSuspendMaxTimeMillis(connectConfig.getBrokerSuspendMaxTimeMillis());
consumer.setConsumerPullTimeoutMillis((long) connectConfig.getRmqMessageConsumeTimeout());
consumer.setLanguage(LanguageCode.JAVA);
return consumer;
}
Aggregations