parent
ae1a66ce02
commit
a37dd6cf56
|
@ -0,0 +1,15 @@
|
|||
package com.mobai;
|
||||
|
||||
import org.springframework.context.ApplicationListener;
|
||||
import org.springframework.context.event.ContextClosedEvent;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class MqttApplicationListener implements ApplicationListener<ContextClosedEvent> {
|
||||
|
||||
@Override
|
||||
public void onApplicationEvent(ContextClosedEvent event) {
|
||||
|
||||
System.out.println("下线前执行了");;
|
||||
}
|
||||
}
|
|
@ -20,10 +20,7 @@ import org.springframework.kafka.annotation.KafkaListener;
|
|||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Properties;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 生产者/消费者
|
||||
|
@ -71,7 +68,12 @@ public class KafkaPCUtils {
|
|||
vin.getBytes(),
|
||||
vehicleString,
|
||||
vehicleString.getBytes(),
|
||||
new Cluster("iYl5vA6ESGaoH5veXYGroQ", list, partitionInfos, null, null)
|
||||
new Cluster(
|
||||
"iYl5vA6ESGaoH5veXYGroQ",
|
||||
list,
|
||||
partitionInfos,
|
||||
new HashSet<String>() {},
|
||||
new HashSet<>())
|
||||
);
|
||||
log.info("当前获取分区:[{}]",partition);
|
||||
// 创建消息 主题 key 分区 值
|
||||
|
|
Loading…
Reference in New Issue