当前位置: 首页>>代码示例>>Java>>正文


Java AdminClientConfig类代码示例

本文整理汇总了Java中org.apache.kafka.clients.admin.AdminClientConfig的典型用法代码示例。如果您正苦于以下问题:Java AdminClientConfig类的具体用法?Java AdminClientConfig怎么用?Java AdminClientConfig使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


AdminClientConfig类属于org.apache.kafka.clients.admin包,在下文中一共展示了AdminClientConfig类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: create

import org.apache.kafka.clients.admin.AdminClientConfig; //导入依赖的package包/类
/**
 * Create a new AdminClient instance.
 * @param clusterConfig What cluster to connect to.
 * @param clientId What clientId to associate the connection with.
 */
public AdminClient create(final ClusterConfig clusterConfig, final String clientId) {
    // Create a map
    final Map<String, Object> config = new HashMap<>();
    config.put(AdminClientConfig.BOOTSTRAP_SERVERS_CONFIG, clusterConfig.getConnectString());
    config.put(AdminClientConfig.CLIENT_ID_CONFIG, clientId);
    config.put(AdminClientConfig.REQUEST_TIMEOUT_MS_CONFIG, requestTimeout);

    if (clusterConfig.isUseSsl()) {
        config.put(CommonClientConfigs.SECURITY_PROTOCOL_CONFIG, "SSL");
        config.put(SslConfigs.SSL_KEYSTORE_LOCATION_CONFIG, keyStoreRootPath + "/" + clusterConfig.getKeyStoreFile());
        config.put(SslConfigs.SSL_KEYSTORE_PASSWORD_CONFIG, clusterConfig.getKeyStorePassword());
        config.put(SslConfigs.SSL_TRUSTSTORE_LOCATION_CONFIG, keyStoreRootPath + "/" + clusterConfig.getTrustStoreFile());
        config.put(SslConfigs.SSL_TRUSTSTORE_PASSWORD_CONFIG, clusterConfig.getTrustStorePassword());
    }

    return KafkaAdminClient.create(config);
}
 
开发者ID:SourceLabOrg,项目名称:kafka-webview,代码行数:23,代码来源:KafkaAdminFactory.java

示例2: init

import org.apache.kafka.clients.admin.AdminClientConfig; //导入依赖的package包/类
@Before
public void init() {
	String multiplier = System.getenv("KAFKA_TIMEOUT_MULTIPLIER");
	if (multiplier != null) {
		timeoutMultiplier = Double.parseDouble(multiplier);
	}

	BrokerAddress[] brokerAddresses = embeddedKafka.getBrokerAddresses();
	List<String> bAddresses = new ArrayList<>();
	for (BrokerAddress bAddress : brokerAddresses) {
		bAddresses.add(bAddress.toString());
	}
	String[] foo = new String[bAddresses.size()];

	Map<String, Object> adminConfigs = new HashMap<>();
	adminConfigs.put(AdminClientConfig.BOOTSTRAP_SERVERS_CONFIG, bAddresses.toArray(foo)[0]);
	adminClient = AdminClient.create(adminConfigs);
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-stream-binder-kafka,代码行数:19,代码来源:KafkaBinderTests.java

示例3: KafkaTopicProvisioner

import org.apache.kafka.clients.admin.AdminClientConfig; //导入依赖的package包/类
public KafkaTopicProvisioner(KafkaBinderConfigurationProperties kafkaBinderConfigurationProperties,
							KafkaProperties kafkaProperties) {
	Assert.isTrue(kafkaProperties != null, "KafkaProperties cannot be null");
	Map<String, Object> adminClientProperties = kafkaProperties.buildAdminProperties();
	String kafkaConnectionString = kafkaBinderConfigurationProperties.getKafkaConnectionString();

	if (ObjectUtils.isEmpty(adminClientProperties.get(AdminClientConfig.BOOTSTRAP_SERVERS_CONFIG))
			|| !kafkaConnectionString.equals(kafkaBinderConfigurationProperties.getDefaultKafkaConnectionString())) {
		adminClientProperties.put(AdminClientConfig.BOOTSTRAP_SERVERS_CONFIG, kafkaConnectionString);
	}
	this.configurationProperties = kafkaBinderConfigurationProperties;
	this.adminClient = AdminClient.create(adminClientProperties);
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-stream-binder-kafka,代码行数:14,代码来源:KafkaTopicProvisioner.java

示例4: getKsqlAdminClientConfigProps

import org.apache.kafka.clients.admin.AdminClientConfig; //导入依赖的package包/类
public Map<String, Object> getKsqlAdminClientConfigProps() {
  Set<String> adminClientConfigProperties = AdminClientConfig.configNames();
  Map<String, Object> adminClientConfigs = new HashMap<>();
  for (Map.Entry<String, Object> entry: ksqlStreamConfigProps.entrySet()) {
    if (adminClientConfigProperties.contains(entry.getKey())) {
      adminClientConfigs.put(entry.getKey(), entry.getValue());
    }
  }
  return adminClientConfigs;
}
 
开发者ID:confluentinc,项目名称:ksql,代码行数:11,代码来源:KsqlConfig.java

示例5: admin

import org.apache.kafka.clients.admin.AdminClientConfig; //导入依赖的package包/类
public AdminClient admin() {
    if (uri == null) throw new Error("uri must not be null");

    Map<String, Object> config = Maps.newHashMap();
    config.put(AdminClientConfig.BOOTSTRAP_SERVERS_CONFIG, uri);
    return AdminClient.create(config);
}
 
开发者ID:neowu,项目名称:core-ng-project,代码行数:8,代码来源:Kafka.java

示例6: testListTopics

import org.apache.kafka.clients.admin.AdminClientConfig; //导入依赖的package包/类
@Test(enabled = false)
public void testListTopics() throws Exception {
    Map<String, Object> adminClientConfig = new HashMap<>();
    adminClientConfig.put(AdminClientConfig.BOOTSTRAP_SERVERS_CONFIG, "api.local.getbux.com:32400,api.local.getbux.com:32401,api.local.getbux.com:32402");
    adminClientConfig.put(AdminClientConfig.CLIENT_ID_CONFIG, "test-adminClient");
    AdminClient adminClient = AdminClient.create(adminClientConfig);

    // ensure all the topics are created
    ListTopicsResult listTopicsResult = adminClient.listTopics();
    Map<String, TopicListing> availableTopics = listTopicsResult.namesToListings().get();

    assertNotNull(availableTopics);
}
 
开发者ID:elasticsoftwarefoundation,项目名称:elasticactors,代码行数:14,代码来源:KafkaAdminClientTest.java

示例7: bootstrapServers

import org.apache.kafka.clients.admin.AdminClientConfig; //导入依赖的package包/类
private String bootstrapServers() {
    Object servers = adminConfig.get(AdminClientConfig.BOOTSTRAP_SERVERS_CONFIG);
    return servers != null ? servers.toString() : "<unknown>";
}
 
开发者ID:YMCoding,项目名称:kafka-0.11.0.0-src-with-comment,代码行数:5,代码来源:TopicAdmin.java


注:本文中的org.apache.kafka.clients.admin.AdminClientConfig类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。