本文整理汇总了Java中org.springframework.kafka.support.serializer.JsonDeserializer类的典型用法代码示例。如果您正苦于以下问题:Java JsonDeserializer类的具体用法?Java JsonDeserializer怎么用?Java JsonDeserializer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
JsonDeserializer类属于org.springframework.kafka.support.serializer包,在下文中一共展示了JsonDeserializer类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: consumerConfigs
import org.springframework.kafka.support.serializer.JsonDeserializer; //导入依赖的package包/类
/**
* reads the config info from yml file
*
* @return
*/
@Bean
public Map<String, Object> consumerConfigs() {
Map<String, Object> propsMap = new HashMap<>();
propsMap.put("bootstrap.servers",
env.getProperty("kafka.broker"));
propsMap.put("enable.auto.commit",
env.getProperty("enable.auto.commit"));
propsMap.put("auto.commit.interval.ms",
env.getProperty("auto.commit.interval.ms"));
propsMap.put("key.deserializer",
StringDeserializer.class);
propsMap.put("value.deserializer",
JsonDeserializer.class);
propsMap.put("group.id",
env.getProperty("group.id"));
propsMap.put("auto.offset.reset",
env.getProperty("kafka.auto.offset.reset"));
return propsMap;
}
开发者ID:sarojrout,项目名称:spring-tutorial,代码行数:26,代码来源:StudentConsumerConfig.java
示例2: consumerConfigs
import org.springframework.kafka.support.serializer.JsonDeserializer; //导入依赖的package包/类
@Bean
public Map<String, Object> consumerConfigs() {
Map<String, Object> props = new HashMap<>();
// list of host:port pairs used for establishing the initial connections to the Kakfa cluster
props.put(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG, bootstrapServers);
props.put(ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG, StringDeserializer.class);
props.put(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG, JsonDeserializer.class);
// allows a pool of processes to divide the work of consuming and processing records
props.put(ConsumerConfig.GROUP_ID_CONFIG, "bot");
return props;
}
开发者ID:corydissinger,项目名称:mtgo-best-bot,代码行数:13,代码来源:BotConfig.java
示例3: consumerFactory
import org.springframework.kafka.support.serializer.JsonDeserializer; //导入依赖的package包/类
/**
* Create the consumers by loading the config
*
* @return
*/
@Bean
public ConsumerFactory<String, Student> consumerFactory() {
return new DefaultKafkaConsumerFactory<>(consumerConfigs(),
new StringDeserializer(), new JsonDeserializer<>(
Student.class));
}
开发者ID:sarojrout,项目名称:spring-tutorial,代码行数:13,代码来源:StudentConsumerConfig.java
示例4: consumerFactory
import org.springframework.kafka.support.serializer.JsonDeserializer; //导入依赖的package包/类
@Bean
public ConsumerFactory<String, Foo> consumerFactory() {
Map<String, Object> props = new HashMap<>();
props.put(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG, this.configProperties.getBrokerAddress());
props.put(ConsumerConfig.GROUP_ID_CONFIG, "s1pGroup");
props.put(ConsumerConfig.ENABLE_AUTO_COMMIT_CONFIG, true);
props.put(ConsumerConfig.AUTO_COMMIT_INTERVAL_MS_CONFIG, 100);
props.put(ConsumerConfig.SESSION_TIMEOUT_MS_CONFIG, 15000);
JsonDeserializer<Foo> jsonDeserializer = new JsonDeserializer<>(Foo.class);
return new DefaultKafkaConsumerFactory<>(props, new StringDeserializer(), jsonDeserializer);
}
开发者ID:SpringOnePlatform2016,项目名称:grussell-spring-kafka,代码行数:12,代码来源:JsonConfiguration.java
示例5: consumerFactory
import org.springframework.kafka.support.serializer.JsonDeserializer; //导入依赖的package包/类
@Bean
public ConsumerFactory<String, DefaultAvMessage> consumerFactory() {
return new DefaultKafkaConsumerFactory<>(
consumerConfigs(),
new StringDeserializer(),
new JsonDeserializer<>(DefaultAvMessage.class)
);
}
开发者ID:dvoraka,项目名称:av-service,代码行数:9,代码来源:KafkaFileClientConfig.java
示例6: consumerConfigs
import org.springframework.kafka.support.serializer.JsonDeserializer; //导入依赖的package包/类
private Map<String, Object> consumerConfigs() {
Map<String, Object> props = new HashMap<>();
props.put(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG, bootstrapServers);
props.put(ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG, StringDeserializer.class);
props.put(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG, JsonDeserializer.class);
props.put(ConsumerConfig.GROUP_ID_CONFIG, "client");
return props;
}
开发者ID:dvoraka,项目名称:av-service,代码行数:10,代码来源:KafkaFileClientConfig.java
示例7: fileServerConsumerFactory
import org.springframework.kafka.support.serializer.JsonDeserializer; //导入依赖的package包/类
@Bean
public ConsumerFactory<String, DefaultAvMessage> fileServerConsumerFactory() {
return new DefaultKafkaConsumerFactory<>(
consumerConfigs(),
new StringDeserializer(),
new JsonDeserializer<>(DefaultAvMessage.class)
);
}
开发者ID:dvoraka,项目名称:av-service,代码行数:9,代码来源:KafkaServerConfig.java
示例8: consumerConfigs
import org.springframework.kafka.support.serializer.JsonDeserializer; //导入依赖的package包/类
private Map<String, Object> consumerConfigs() {
Map<String, Object> props = new HashMap<>();
props.put(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG, bootstrapServers);
props.put(ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG, StringDeserializer.class);
props.put(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG, JsonDeserializer.class);
props.put(ConsumerConfig.GROUP_ID_CONFIG, "server");
return props;
}
开发者ID:dvoraka,项目名称:av-service,代码行数:10,代码来源:KafkaServerConfig.java
示例9: consumerConfigs
import org.springframework.kafka.support.serializer.JsonDeserializer; //导入依赖的package包/类
@Bean
public Map<String, Object> consumerConfigs() {
Map<String, Object> props = new HashMap<>();
props.put(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG, bootstrapServers);
props.put(ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG, StringDeserializer.class);
props.put(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG, JsonDeserializer.class);
props.put(ConsumerConfig.GROUP_ID_CONFIG, "json");
return props;
}
开发者ID:code-not-found,项目名称:spring-kafka,代码行数:11,代码来源:ReceiverConfig.java
示例10: consumerFactory
import org.springframework.kafka.support.serializer.JsonDeserializer; //导入依赖的package包/类
@Bean
public ConsumerFactory<String, LifecycleEvent> consumerFactory() {
return new DefaultKafkaConsumerFactory<>(consumerConfigs(), new StringDeserializer(), new JsonDeserializer<>(LifecycleEvent.class));
}
开发者ID:corydissinger,项目名称:mtgo-best-bot,代码行数:5,代码来源:BotConfig.java
示例11: consumerFactory
import org.springframework.kafka.support.serializer.JsonDeserializer; //导入依赖的package包/类
@Bean
public ConsumerFactory<String, Car> consumerFactory() {
return new DefaultKafkaConsumerFactory<>(consumerConfigs(), new StringDeserializer(),
new JsonDeserializer<>(Car.class));
}
开发者ID:code-not-found,项目名称:spring-kafka,代码行数:6,代码来源:ReceiverConfig.java
注:本文中的org.springframework.kafka.support.serializer.JsonDeserializer类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论