Skip to content

Latest commit

 

History

History
 
 

springboot-kafka

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

基础配置

  • 提供者producer yml中修改spring.kafka.bootstrap-servers为你实际的kafka地址

  • 消费者consumer yml中修改spring.kafka.bootstrap-servers为你实际的kafka地址 yml中修改kafka.topic为你实际需要监听的topic yml中修改kafka.group为你的消费分组,相同组内的消费者不会重复消费同一条消息,起到负载均衡的作用

测试接口

基础地址 http://localhost:9999

1. 普通消息
localhost:9999/send?message=hello&topic=test

2. 发送json
```json
Request URL:  http://localhost:9999/send
Request Method: POST
Request Headers:
{
   "Content-Type":"application/json"
}
Request Body:
{
    "topic": "test",
    "message": {
        "data": "hello"
    }
}