色综合图-色综合图片-色综合图片二区150p-色综合图区-玖玖国产精品视频-玖玖香蕉视频

您的位置:首頁技術文章
文章詳情頁

Java使用pulsar-flink-connector讀取pulsar catalog元數據代碼剖析

瀏覽:3日期:2023-02-10 13:03:05
簡介

通過 pulsar-flink-connector 讀取到 Apache pulsar 中的namespaces、topics的元數據信息。pulsar-flink-connector 的 github: https://github.com/streamnative/pulsar-flink

Maven

<dependency> <groupId>io.streamnative.connectors</groupId> <artifactId>pulsar-flink-connector-2.11-1.12</artifactId> <version>2.7.3</version> </dependency> <!-- JAR repositories --> <repositories><repository> <id>central</id> <layout>default</layout> <url>https://repo1.maven.org/maven2</url></repository><repository> <id>bintray-streamnative-maven</id> <name>bintray</name> <url>https://dl.bintray.com/streamnative/maven</url></repository> </repositories>CODE

使用PulsarMetadataReader獲取元數據

package com.levi.demo;import org.apache.flink.streaming.connectors.pulsar.internal.PulsarMetadataReader;import org.apache.pulsar.client.admin.PulsarAdminException;import org.apache.pulsar.client.impl.auth.AuthenticationToken;import org.apache.pulsar.client.impl.conf.ClientConfigurationData;import org.apache.pulsar.common.schema.SchemaInfo;import org.apache.pulsar.common.schema.SchemaType;import java.io.IOException;import java.util.HashMap;import java.util.List;import java.util.Map;/** * Test. * * @author levi * @version 1.0 **/public class Test { public static void main(String[] args) {final ClientConfigurationData configurationData = new ClientConfigurationData();configurationData.setServiceUrl('pulsar://127.0.0.1:6650');//Your Pulsar Tokenfinal AuthenticationToken token =new AuthenticationToken('eyJxxxxxxxxxxx.eyxxxxxxxxxxxxx.xxxxxxxxxxx'); configurationData.setAuthentication(token); try (final PulsarMetadataReader reader = new PulsarMetadataReader('http://127.0.0.1:8443', configurationData, '', new HashMap(), -1, -1)) { //獲取namespaces final List<String> namespaces = reader.listNamespaces(); System.out.println('namespaces: ' + namespaces.toString());for (final String namespace : namespaces) {//獲取Topicsfinal List<String> topics = reader.getTopics(namespace);System.out.println('topic: ' + topics.toString());for (String topic : topics) { //獲取字段SchemaInfo final SchemaInfo schemaInfo = reader.getPulsarSchema(topic); final String name = schemaInfo.getName(); System.out.println('SchemaName:' + name); //topicName final SchemaType type = schemaInfo.getType(); System.out.println('SchemaType:' + type.toString());// 'JSON'... final Map<String, String> properties = schemaInfo.getProperties(); System.out.println(properties); final String schemaDefinition = schemaInfo.getSchemaDefinition(); System.out.println(schemaDefinition); // Field info.} }} catch (IOException | PulsarAdminException e) { e.printStackTrace();} }}

到此這篇關于Java使用pulsar-flink-connector讀取pulsar catalog元數據的文章就介紹到這了,更多相關Java讀取pulsar catalog元數據內容請搜索好吧啦網以前的文章或繼續瀏覽下面的相關文章希望大家以后多多支持好吧啦網!

標簽: Java
相關文章:
主站蜘蛛池模板: 热99re久久精品2久久久 | 网友自拍第一页 | 日本黄色毛片 | 久草视频免费在线 | 黄色a三级三级三级免费看 黄色a网 | 中文字幕在线免费观看 | 国产全部理论片线观看 | 久草免费在线视频 | 欧美xxxxx九色视频免费观看 | 狼人激情网 | 亚洲精品毛片久久久久久久 | 91国内视频在线观看 | 草草影院欧美三级日本 | 精品久久久久亚洲 | 一级毛片不卡免费看老司机 | 精品久久久久中文字幕日本 | 久久在线影院 | 亚洲成年人网址 | 亚洲自拍成人 | 亚洲线精品久久一区二区三区 | 亚洲高清无在码在线无弹窗 | 国产特黄特色的大片观看免费视频 | 性久久久久久 | 热re66久久精品国产99热 | 免费 视频 1级 | 农村寡妇野外情一级毛片 | 国产精品青草久久久久福利99 | 精品亚洲福利一区二区 | 国产一级毛片视频在线! | 久草免费精品视频 | 一级一片免费看 | 精品区 | a理论片| 日韩视频大全 | 国产一级a毛片高清 | 国产成人啪精品午夜在线观看 | 新26uuu在线亚洲欧美 | 成人免费黄色网址 | 美国毛片亚洲社区在线观看 | 在线毛片观看 | 中文字幕在线观看日韩 |