本文整理汇总了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;
}
示例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;
}
示例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
}
示例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);
示例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);