use of com.qlangtech.tis.async.message.client.consumer.impl.MQListenerFactory in project plugins by qlangtech.
the class TestPlugin method testSerialize.
public void testSerialize() throws Exception {
IPluginStore<MQListenerFactory> pluginStore = TIS.getPluginStore(collection, MQListenerFactory.class);
// IncrComponent incrComponent = createIncrComponent();
List<MQListenerFactory> mqListenerFactory = pluginStore.getPlugins();
UploadPluginMeta meta = UploadPluginMeta.parse("mq");
HeteroList<MQListenerFactory> hList = new HeteroList<>(meta);
hList.setCaption("MQ消息监听");
hList.setItems(mqListenerFactory);
hList.setDescriptors(TIS.getPluginStore(MQListenerFactory.class).allDescriptor());
assertEquals(1, hList.getDescriptors().size());
PluginFormProperties propertyTypes;
for (Descriptor<MQListenerFactory> f : hList.getDescriptors()) {
System.out.println(f.getId());
// getPropertyTypes();
propertyTypes = f.getPluginFormPropertyTypes();
for (Map.Entry<String, PropertyType> entry : propertyTypes.getKVTuples()) {
System.out.println(entry.getKey() + ":" + entry.getValue());
}
}
JSONObject j = hList.toJSON();
System.out.println("==============================");
System.out.println(j.toJSONString());
System.out.println("==============================");
}
use of com.qlangtech.tis.async.message.client.consumer.impl.MQListenerFactory in project tis by qlangtech.
the class HeteroEnum method getIncrSourceListenerFactory.
public static MQListenerFactory getIncrSourceListenerFactory(String dataXName) {
IPluginContext pluginContext = IPluginContext.namedContext(dataXName);
List<MQListenerFactory> mqFactories = MQ.getPlugins(pluginContext, null);
MQListenerFactory mqFactory = null;
for (MQListenerFactory factory : mqFactories) {
mqFactory = factory;
}
Objects.requireNonNull(mqFactory, "mqFactory can not be null, mqFactories size:" + mqFactories.size());
return mqFactory;
}
use of com.qlangtech.tis.async.message.client.consumer.impl.MQListenerFactory in project plugins by qlangtech.
the class TestRocketMQListenerFactory method testCreateConsumerStatus.
public void testCreateConsumerStatus() {
IPluginStore<MQListenerFactory> mqListenerFactory = TIS.getPluginStore(collection, MQListenerFactory.class);
assertNotNull(mqListenerFactory);
MQListenerFactory plugin = mqListenerFactory.getPlugin();
assertNotNull(plugin);
IMQConsumerStatusFactory.IMQConsumerStatus consumerStatus = plugin.createConsumerStatus();
assertNotNull(consumerStatus);
// assertTrue(consumerStatus.getTotalDiff() > 0);
}
use of com.qlangtech.tis.async.message.client.consumer.impl.MQListenerFactory in project plugins by qlangtech.
the class TestIncrComponent method testLoad.
public void testLoad() {
// IncrComponent incrComponent = TIS.get().loadIncrComponent(collection);
IPluginStore<MQListenerFactory> pluginStore = TIS.getPluginStore(collection, MQListenerFactory.class);
// assertNotNull(incrComponent);
// incrComponent.getMqListenerFactory();
List<MQListenerFactory> mqListenerFactoryList = pluginStore.getPlugins();
assertEquals(1, mqListenerFactoryList.size());
MQListenerFactory mqListenerFactory = mqListenerFactoryList.stream().findFirst().get();
assertTrue(mqListenerFactory instanceof RocketMQListenerFactory);
RocketMQListenerFactory rmFactory = (RocketMQListenerFactory) mqListenerFactory;
assertEquals("c_otter_binlogorder_solr", rmFactory.getConsumeName());
assertEquals("otter_binlogorder", rmFactory.getMqTopic());
assertEquals("10.1.21.148:9876", rmFactory.getNamesrvAddr());
assertTrue(rmFactory.getDeserialize() instanceof DefaultJSONFormatDeserialize);
// assertEquals(collection, incrComponent.getCollection());
}
use of com.qlangtech.tis.async.message.client.consumer.impl.MQListenerFactory in project plugins by qlangtech.
the class TISFlinkCDCStart method deploy.
private static void deploy(TargetResName dataxName, BasicFlinkSourceHandle tableStreamHandle, ReplicasSpec incrSpec, long timestamp) throws Exception {
// BasicFlinkSourceHandle tisFlinkSourceHandle = new TISFlinkSourceHandle();
if (tableStreamHandle == null) {
throw new IllegalStateException("tableStreamHandle has not been instantiated");
}
// ElasticSearchSinkFactory esSinkFactory = new ElasticSearchSinkFactory();
// IPluginContext pluginContext = IPluginContext.namedContext(dataxName.getName());
// List<TISSinkFactory> sinkFactories = TISSinkFactory.sinkFactory.getPlugins(pluginContext, null);
// logger.info("sinkFactories size:" + sinkFactories.size());
// for (TISSinkFactory factory : sinkFactories) {
// sinkFactory = factory;
// break;
// }
// Objects.requireNonNull(sinkFactory, "sinkFactories.size():" + sinkFactories.size());
tableStreamHandle.setSinkFuncFactory(TISSinkFactory.getIncrSinKFactory(dataxName.getName()));
// List<MQListenerFactory> mqFactories = HeteroEnum.MQ.getPlugins(pluginContext, null);
MQListenerFactory mqFactory = HeteroEnum.getIncrSourceListenerFactory(dataxName.getName());
mqFactory.setConsumerHandle(tableStreamHandle);
// for (MQListenerFactory factory : mqFactories) {
// factory.setConsumerHandle(tableStreamHandle);
// mqFactory = factory;
// }
// Objects.requireNonNull(mqFactory, "mqFactory can not be null, mqFactories size:" + mqFactories.size());
IMQListener mq = mqFactory.create();
IDataxProcessor dataXProcess = DataxProcessor.load(null, dataxName.getName());
DataxReader reader = (DataxReader) dataXProcess.getReader(null);
if (reader == null) {
throw new IllegalStateException("dataXReader is illegal");
}
// DBConfigGetter rdbmsReader = (DBConfigGetter) reader;
List<ISelectedTab> tabs = reader.getSelectedTabs();
mq.start(dataxName, reader, tabs, dataXProcess);
}
Aggregations