Commit e86520b8 authored by litengwei's avatar litengwei

消费者实例改为两个实例进行消费

parent 5a4174b4
...@@ -28,7 +28,7 @@ public class KafkaConsumerService { ...@@ -28,7 +28,7 @@ public class KafkaConsumerService {
* 消费单条消息,topics 可以监听多个topic,如:topics = {"topic1", "topic2"} * 消费单条消息,topics 可以监听多个topic,如:topics = {"topic1", "topic2"}
* @param message 消息 * @param message 消息
*/ */
@KafkaListener(id = "consumerSingle", topics = "#{'${kafka.topics}'.split(',')}", errorHandler = "consumerAwareListenerErrorHandler") @KafkaListener(id = "consumerSingle", topics = "#{'${kafka.topics}'.split(',')}", concurrency = "2")
public void consumerSingle(String message,Acknowledgment ack) { public void consumerSingle(String message,Acknowledgment ack) {
JSONObject messageObj = JSONObject.fromObject(message); JSONObject messageObj = JSONObject.fromObject(message);
String topic = messageObj.getString("topic"); String topic = messageObj.getString("topic");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment