|
|
@ -23,6 +23,10 @@ public class MessageSubscription implements CommandLineRunner { |
|
|
|
|
|
|
|
@Autowired |
|
|
|
@Qualifier("iotRedisStream") |
|
|
|
private RedisStream iotRedisStream; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
@Qualifier("redisStream") |
|
|
|
private RedisStream redisStream; |
|
|
|
|
|
|
|
@Resource |
|
|
@ -45,57 +49,98 @@ public class MessageSubscription implements CommandLineRunner { |
|
|
|
@Resource |
|
|
|
private DeviceFunctionReplyListener deviceFunctionReplyListener; |
|
|
|
|
|
|
|
@Resource |
|
|
|
private TrafficGantryTransactionsListener trafficGantryTransactionsListener; |
|
|
|
|
|
|
|
@Resource |
|
|
|
private TrafficGantryPlatesListener trafficGantryPlatesListener; |
|
|
|
|
|
|
|
@Resource |
|
|
|
private TrafficTollStationEntranceListener trafficTollStationEntranceListener; |
|
|
|
|
|
|
|
@Resource |
|
|
|
private TrafficTollStationExitListener trafficTollStationExitListener; |
|
|
|
|
|
|
|
@Override |
|
|
|
public void run(String... args) { |
|
|
|
|
|
|
|
// 设备在线消息订阅
|
|
|
|
redisStream.subscriptionAutoAck( |
|
|
|
iotRedisStream.subscriptionAutoAck( |
|
|
|
RedisStreamConstants.DeviceOnline.KEY, |
|
|
|
RedisStreamConstants.DeviceOnline.GROUP, |
|
|
|
RedisStreamConstants.DeviceOnline.CONSUMER, |
|
|
|
onlineMessageListener); |
|
|
|
|
|
|
|
// 离线消息订阅
|
|
|
|
redisStream.subscriptionAutoAck( |
|
|
|
iotRedisStream.subscriptionAutoAck( |
|
|
|
RedisStreamConstants.DeviceOffline.KEY, |
|
|
|
RedisStreamConstants.DeviceOffline.GROUP, |
|
|
|
RedisStreamConstants.DeviceOffline.CONSUMER, |
|
|
|
offlineMessageListener); |
|
|
|
|
|
|
|
// 设备事件订阅
|
|
|
|
redisStream.subscriptionAutoAck( |
|
|
|
iotRedisStream.subscriptionAutoAck( |
|
|
|
RedisStreamConstants.DeviceEvent.KEY, |
|
|
|
RedisStreamConstants.DeviceEvent.GROUP, |
|
|
|
RedisStreamConstants.DeviceEvent.CONSUMER, |
|
|
|
deviceEventListener); |
|
|
|
|
|
|
|
// 设备属性上报消息订阅
|
|
|
|
redisStream.subscriptionAutoAck( |
|
|
|
iotRedisStream.subscriptionAutoAck( |
|
|
|
RedisStreamConstants.DevicePropertyReport.KEY, |
|
|
|
RedisStreamConstants.DevicePropertyReport.GROUP, |
|
|
|
RedisStreamConstants.DevicePropertyReport.CONSUMER, |
|
|
|
devicePropertyReportListener); |
|
|
|
|
|
|
|
// 读取属性回复消息订阅
|
|
|
|
redisStream.subscriptionAutoAck( |
|
|
|
iotRedisStream.subscriptionAutoAck( |
|
|
|
RedisStreamConstants.DevicePropertyReadReply.KEY, |
|
|
|
RedisStreamConstants.DevicePropertyReadReply.GROUP, |
|
|
|
RedisStreamConstants.DevicePropertyReadReply.CONSUMER, |
|
|
|
devicePropertyReadReplyListener); |
|
|
|
|
|
|
|
// 写属性回复消息订阅
|
|
|
|
redisStream.subscriptionAutoAck( |
|
|
|
iotRedisStream.subscriptionAutoAck( |
|
|
|
RedisStreamConstants.DevicePropertyWriteReply.KEY, |
|
|
|
RedisStreamConstants.DevicePropertyWriteReply.GROUP, |
|
|
|
RedisStreamConstants.DevicePropertyWriteReply.CONSUMER, |
|
|
|
devicePropertyWriteReplyListener); |
|
|
|
|
|
|
|
// 调用功能回复消息订阅
|
|
|
|
redisStream.subscriptionAutoAck( |
|
|
|
iotRedisStream.subscriptionAutoAck( |
|
|
|
RedisStreamConstants.DeviceFunctionReply.KEY, |
|
|
|
RedisStreamConstants.DeviceFunctionReply.GROUP, |
|
|
|
RedisStreamConstants.DeviceFunctionReply.CONSUMER, |
|
|
|
deviceFunctionReplyListener); |
|
|
|
|
|
|
|
|
|
|
|
// 门架交易流水
|
|
|
|
redisStream.subscriptionAutoAck( |
|
|
|
RedisStreamConstants.TrafficGantryTransactions.KEY, |
|
|
|
RedisStreamConstants.TrafficGantryTransactions.GROUP, |
|
|
|
RedisStreamConstants.TrafficGantryTransactions.CONSUMER, |
|
|
|
trafficGantryTransactionsListener); |
|
|
|
|
|
|
|
// 门架牌识
|
|
|
|
iotRedisStream.subscriptionAutoAck( |
|
|
|
RedisStreamConstants.TrafficGantryPlates.KEY, |
|
|
|
RedisStreamConstants.TrafficGantryPlates.GROUP, |
|
|
|
RedisStreamConstants.TrafficGantryPlates.CONSUMER, |
|
|
|
trafficGantryPlatesListener); |
|
|
|
|
|
|
|
// 收费入口数据
|
|
|
|
redisStream.subscriptionAutoAck( |
|
|
|
RedisStreamConstants.TrafficTollStationEntrance.KEY, |
|
|
|
RedisStreamConstants.TrafficTollStationEntrance.GROUP, |
|
|
|
RedisStreamConstants.TrafficTollStationEntrance.CONSUMER, |
|
|
|
trafficTollStationEntranceListener); |
|
|
|
|
|
|
|
// 收费出口数据
|
|
|
|
redisStream.subscriptionAutoAck( |
|
|
|
RedisStreamConstants.TrafficTollStationExit.KEY, |
|
|
|
RedisStreamConstants.TrafficTollStationExit.GROUP, |
|
|
|
RedisStreamConstants.TrafficTollStationExit.CONSUMER, |
|
|
|
trafficTollStationExitListener); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|