Giter Club home page Giter Club logo

spring-boot-kafka-demo's Introduction

spring-boot-kafka-demo

基于spring boot的spring kafka组件的使用demo,包含几个demo讲解。

更新了依赖版本

#这个demo需要提前创建两个topic,或者自己创建两个,然后在配置文件中修改成自己的就可以了

afka-topics --zookeeper localhost:2181 --create --topic s1p.topic --partitions 5 --replication-factor 1

kafka-topics --zookeeper localhost:2181 --create --topic s1p.fooTopic --partitions 5 --replication-factor 1

#总共有9个例子 1.第一个例子介绍的是简单的向topic(s1p.topic)发送简单数据 2.第二个例子介绍的是通过注解 @KafkaListener 接受来自topic (s1p.topic)的消息 3.第三个例子介绍的是通过@KafkaListener 指定使用那个partition处理某个topic的数据 4.第四个例子介绍的是指定偏移量(offset)的注解接受数据实例 5.第五个例子介绍的是将value数据 json序列化和反序列化操作,在这个例子中将CommonConfiguration替换为了JsonConfiguration (类Foo)硬编码到反序列化器——这是必需的,因为JSON不包含任何类型的信息 6.第六个例子介绍的是使用更灵活地StringJsonMessageConverter 代替json的序列化和反序列化,使用这个的好处是 可做类型转换。只要filed是相对应的就可以转化为一个对象。 7.第七个例子是对第二个例子的拓展,在监听那儿添加了重试和过滤 8.第八个例子介绍的是使用更低级的KafkaMessageListenerContainer 替代 @KafkaListener 9.第9个例子是手动通过代码Acknowledgment提交offset的例子

#如何测试: 1.比如测试第一个例子 则进入包 app1 ,run运行main方法即可

spring-boot-kafka-demo's People

Contributors

lilaizhencn avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.