Search in sources :

Example 1 with MQListenerFactory

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("==============================");
}
Also used : HeteroList(com.qlangtech.tis.util.HeteroList) UploadPluginMeta(com.qlangtech.tis.util.UploadPluginMeta) PropertyType(com.qlangtech.tis.extension.impl.PropertyType) PluginFormProperties(com.qlangtech.tis.extension.PluginFormProperties) JSONObject(com.alibaba.fastjson.JSONObject) RocketMQListenerFactory(com.qlangtech.async.message.client.consumer.RocketMQListenerFactory) MQListenerFactory(com.qlangtech.tis.async.message.client.consumer.impl.MQListenerFactory) Map(java.util.Map)

Example 2 with MQListenerFactory

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;
}
Also used : MQListenerFactory(com.qlangtech.tis.async.message.client.consumer.impl.MQListenerFactory)

Example 3 with MQListenerFactory

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);
}
Also used : MQListenerFactory(com.qlangtech.tis.async.message.client.consumer.impl.MQListenerFactory) IMQConsumerStatusFactory(com.qlangtech.tis.async.message.client.consumer.IMQConsumerStatusFactory)

Example 4 with MQListenerFactory

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());
}
Also used : DefaultJSONFormatDeserialize(com.qlangtech.async.message.client.to.impl.DefaultJSONFormatDeserialize) RocketMQListenerFactory(com.qlangtech.async.message.client.consumer.RocketMQListenerFactory) MQListenerFactory(com.qlangtech.tis.async.message.client.consumer.impl.MQListenerFactory) RocketMQListenerFactory(com.qlangtech.async.message.client.consumer.RocketMQListenerFactory)

Example 5 with MQListenerFactory

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);
}
Also used : MQListenerFactory(com.qlangtech.tis.async.message.client.consumer.impl.MQListenerFactory) ISelectedTab(com.qlangtech.tis.plugin.ds.ISelectedTab) IDataxProcessor(com.qlangtech.tis.datax.IDataxProcessor) DataxReader(com.qlangtech.tis.datax.impl.DataxReader) IMQListener(com.qlangtech.tis.async.message.client.consumer.IMQListener)

Aggregations

MQListenerFactory (com.qlangtech.tis.async.message.client.consumer.impl.MQListenerFactory)7 RocketMQListenerFactory (com.qlangtech.async.message.client.consumer.RocketMQListenerFactory)3 DefaultJSONFormatDeserialize (com.qlangtech.async.message.client.to.impl.DefaultJSONFormatDeserialize)2 IMQListener (com.qlangtech.tis.async.message.client.consumer.IMQListener)2 IDataxProcessor (com.qlangtech.tis.datax.IDataxProcessor)2 HdfsColMeta (com.alibaba.datax.plugin.writer.hdfswriter.HdfsColMeta)1 JSONObject (com.alibaba.fastjson.JSONObject)1 Lists (com.google.common.collect.Lists)1 Maps (com.google.common.collect.Maps)1 TestBasicFlinkSourceHandle (com.qlangtech.plugins.incr.flink.cdc.source.TestBasicFlinkSourceHandle)1 IMQConsumerStatusFactory (com.qlangtech.tis.async.message.client.consumer.IMQConsumerStatusFactory)1 TargetResName (com.qlangtech.tis.coredefine.module.action.TargetResName)1 DataxReader (com.qlangtech.tis.datax.impl.DataxReader)1 PluginFormProperties (com.qlangtech.tis.extension.PluginFormProperties)1 PropertyType (com.qlangtech.tis.extension.impl.PropertyType)1 TisUTF8 (com.qlangtech.tis.manage.common.TisUTF8)1 SelectedTab (com.qlangtech.tis.plugin.datax.SelectedTab)1 BasicDataXRdbmsReader (com.qlangtech.tis.plugin.datax.common.BasicDataXRdbmsReader)1 RdbmsReaderContext (com.qlangtech.tis.plugin.datax.common.RdbmsReaderContext)1 com.qlangtech.tis.plugin.ds (com.qlangtech.tis.plugin.ds)1