内容简介:Spring for Apache Kafka 2.1.0 已发布,同时发布的还有 1.3.2 和 2.0.2 维护版本,包含重要的 Bug 修复。 2.1.0 版本的主要将 kafka-clients 库升级到 1.0.0,以及一些改进: Sometimes, when a message can’...
Spring for Apache Kafka 2.1.0 已发布,同时发布的还有 1.3.2 和 2.0.2 维护版本,包含重要的 Bug 修复。
2.1.0 版本的主要将 kafka-clients 库升级到 1.0.0,以及一些改进:
Sometimes, when a message can’t be processed, you may wish to stop the container so the condition can be corrected and the message re-delivered. The framework now provides the
ContainerStoppingErrorHandlerfor record listeners andContainerStoppingBatchErrorHandlerfor batch listeners.The
KafkaAdminnow supports increasing partitions when aNewTopicbean is detected with a larger number of partitions than currently exist on the topic.StringJsonMessageConverterandJsonSerializer/JsonDeserializernow pass and consume type information inHeaders. This allows multiple types to be easily sent/received on the same topic:
@SpringBootApplication
public class Kafka21Application {
public static void main(String[] args) {
SpringApplication.run(Kafka21Application.class, args)
.close();
}
@Bean
public ApplicationRunner runner(KafkaTemplate<Object, Object> template) {
return args -> {
template.send(MessageBuilder.withPayload(42)
.setHeader(KafkaHeaders.TOPIC, "blog")
.build());
template.send(MessageBuilder.withPayload("43")
.setHeader(KafkaHeaders.TOPIC, "blog")
.build());
Thread.sleep(5_000);
};
}
@Bean
public StringJsonMessageConverter converter() {
return new StringJsonMessageConverter();
}
@Component
@KafkaListener(id = "multi", topics = "blog")
public static class Listener {
@KafkaHandler
public void intListener(Integer in) {
System.out.println("Got an int: " + in);
}
@KafkaHandler
public void stringListener(String in) {
System.out.println("Got a string: " + in);
}
}
}Got an int: 42 Got a string: 43
the
JsonSerializerandJsonDeserializercan be configured using kafka properties for the producer/consumer.
【声明】文章转载自:开源中国社区 [http://www.oschina.net]
以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,也希望大家多多支持 码农网
猜你喜欢:- NPM包(模块)发布、更新、撤销发布
- 有赞灰度发布与蓝绿发布实践
- 【重磅发布】Linkis 0.10.0 版本发布
- BeetlSQL 3.0.9 发布,Idea 插件发布
- 贝密游戏 0.7.0 发布,发布斗地主
- 【重磅发布】DataSphere Studio 0.9.0 版本发布
本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们。
神经网络与机器学习(原书第3版)
[加] Simon Haykin / 申富饶、徐烨、郑俊、晁静 / 机械工业出版社 / 2011-3 / 79.00元
神经网络是计算智能和机器学习的重要分支,在诸多领域都取得了很大的成功。在众多神经网络著作中,影响最为广泛的是Simon Haykin的《神经网络原理》(第3版更名为《神经网络与机器学习》)。在本书中,作者结合近年来神经网络和机器学习的最新进展,从理论和实际应用出发,全面、系统地介绍了神经网络的基本模型、方法和技术,并将神经网络和机器学习有机地结合在一起。 本书不但注重对数学分析方法和理论的探......一起来看看 《神经网络与机器学习(原书第3版)》 这本书的介绍吧!