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


Java Encoder类代码示例

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


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

示例1: getProducer

import kafka.serializer.Encoder; //导入依赖的package包/类
public <T> Producer<T> getProducer(Class<? extends Encoder<T>> clazz) {
	Producer<T> propducer = null;
	if (clazz != null && !clazz.isInterface()) {
		Properties configProp = KafKaUtils.getDefaultKafkaProperties();
		configProp.put(KafkaConstants.SERIALIZER_CLASS, clazz.getCanonicalName());
		propducer = new ProducerImpl<String, T>(configProp);
	}
	return propducer;
}
 
开发者ID:aakash7864,项目名称:Simple-Kafka,代码行数:10,代码来源:KafakaProducerServiceImpl.java

示例2: getProducers

import kafka.serializer.Encoder; //导入依赖的package包/类
public <T> List<Producer<T>> getProducers(int numOfProducer, Class<? extends Encoder<T>> clazz) {
	List<Producer<T>> producerList = new ArrayList<Producer<T>>();
	if (numOfProducer > 0) {
		for (int i = 0; i < numOfProducer; i++) {
			producerList.add(getProducer(clazz));
		}
	}
	return producerList;
}
 
开发者ID:aakash7864,项目名称:Simple-Kafka,代码行数:10,代码来源:KafakaProducerServiceImpl.java

示例3: KruxProducerEventHandler

import kafka.serializer.Encoder; //导入依赖的package包/类
public KruxProducerEventHandler(ProducerConfig config, Partitioner partitioner, Encoder encoder, Encoder keyEncoder,
        ProducerPool producerPool, HashMap topicPartitionInfos) {
    super(config, partitioner, encoder, keyEncoder, producerPool, topicPartitionInfos);
    // TODO Auto-generated constructor stub
}
 
开发者ID:krux,项目名称:tcp-stream-kafka-producer,代码行数:6,代码来源:KruxProducerEventHandler.java

示例4: getProducer

import kafka.serializer.Encoder; //导入依赖的package包/类
/**
 * Created a kafka producer to send data of Type T to kafka cluster.Producer
 * is configured with the default configuration specified in properties
 * file.
 * 
 * @param clazz
 *            - Encoder class for producer to send data of specific type as
 *            given in Encoder
 * @return <T> Producer<T> - Producer that can send data if type T
 */
<T> Producer<T> getProducer(Class<? extends Encoder<T>> clazz);
 
开发者ID:aakash7864,项目名称:Simple-Kafka,代码行数:12,代码来源:KafakaProducerService.java

示例5: getProducers

import kafka.serializer.Encoder; //导入依赖的package包/类
/**
 * Provides a list kafka producer to send data of Type T to kafka
 * cluster.Producer is configured with the default configuration specified
 * in properties file.
 * 
 * @param numOfProducer
 *            - number of Producer to create
 * @param clazz
 *            - Encoder class for producer to send data of specific type as
 *            given in Encoder
 * @return <T> List<Producer<T>> - list of producer of Type T with respect
 *         to @param
 */
<T> List<Producer<T>> getProducers(int numOfProducer, Class<? extends Encoder<T>> clazz);
 
开发者ID:aakash7864,项目名称:Simple-Kafka,代码行数:15,代码来源:KafakaProducerService.java


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