消息队列Kafka版的管控API提供获取实例、Topic和Consumer Group信息的接口。

获取SDK

  • 使用项目构建工具的方式:
    <dependency>
        <groupId>com.aliyun</groupId>
        <artifactId>aliyun-java-sdk-core</artifactId>
        <version>4.4.9</version>
    </dependency>
    <dependency>
        <groupId>com.aliyun</groupId>
        <artifactId>aliyun-java-sdk-alikafka</artifactId>
        <version>1.2.4</version>
    </dependency>
    
    compile group: 'com.aliyun', name: 'aliyun-java-sdk-core', version: '4.4.9'
    compile group: 'com.aliyun', name: 'aliyun-java-sdk-alikafka', version: '1.2.4'
    libraryDependencies += "com.aliyun" % "aliyun-java-sdk-core" % "4.4.9"
    libraryDependencies += "com.aliyun" % "aliyun-java-sdk-alikafka" % "1.2.4"
    <dependency org="com.aliyun" name="aliyun-java-sdk-core" rev="4.4.9"/>
    <dependency org="com.aliyun" name="aliyun-java-sdk-alikafka" rev="1.2.4"/>
    @Grapes(
        @Grab(group='com.aliyun', module='aliyun-java-sdk-core', version='4.4.9')
    )
    @Grapes(
        @Grab(group='com.aliyun', module='aliyun-java-sdk-alikafka', version='1.2.4')
    )
    
    [com.aliyun/aliyun-java-sdk-core "4.4.9"]
    [com.aliyun/aliyun-java-sdk-alikafka "1.2.4"]
    
    'com.aliyun:aliyun-java-sdk-core:jar:4.4.9'
    'com.aliyun:aliyun-java-sdk-alikafka:jar:1.2.4'

  • 下载依赖JAR包的方式:

设置公共参数

构建并启动客户端时需要设置一系列参数信息,具体示例如下:

public static void main(String[] args) {
    //构建Client
    IAcsClient iAcsClient = buildAcsClient();
 }
 private static IAcsClient buildAcsClient() {
        //鉴权使用的AccessKeyId,由阿里云官网控制台获取
        String accessKey = "XXXXXX";
        //鉴权使用的AccessKeySecret,由阿里云官网控制台获取
        String secretKey = "XXXXXX";

        //产品Code,消息队列Kafka版产品常量值为“alikafka”
        String productName = "alikafka";

        //API的网关所在地域,目前支持的有cn-beijing 和 cn-hangzhou 等
        String regionId = "cn-beijing";
        //接入点名称同regionId一致
        String endPointName = "cn-beijing";
        //对应endPoint的域名
        String domain = "alikafka.cn-beijing.aliyuncs.com";

        try {
            DefaultProfile.addEndpoint(endPointName, regionId, productName, domain);
        } catch (ClientException e) {
            //log error
        }
        //构造 Client
        IClientProfile profile = DefaultProfile.getProfile(regionId, accessKey, secretKey);
        return new DefaultAcsClient(profile);
}

接入点列表

地域名称 RegionId Domain
华东1(杭州) cn-hangzhou alikafka.cn-hangzhou.aliyuncs.com
华东2(上海) cn-shanghai alikafka.cn-shanghai.aliyuncs.com
华北1(青岛) cn-qingdao alikafka.cn-qingdao.aliyuncs.com
华北2(北京) cn-beijing alikafka.cn-beijing.aliyuncs.com
华北3(张家口) cn-zhangjiakou alikafka.cn-zhangjiakou.aliyuncs.com
华北5(呼和浩特) cn-huhehaote alikafka.cn-huhehaote.aliyuncs.com
华南1(深圳) cn-shenzhen alikafka.cn-shenzhen.aliyuncs.com
中国(香港) cn-hongkong alikafka.cn-hongkong.aliyuncs.com
新加坡 ap-southeast-1 alikafka.ap-southeast-1.aliyuncs.com

使用限制

单用户单接口的请求频率的限制为3 QPS。