|
@ -23,6 +23,10 @@ public class MessageSubscription implements CommandLineRunner { |
|
|
|
|
|
|
|
|
@Autowired |
|
|
@Autowired |
|
|
@Qualifier("iotRedisStream") |
|
|
@Qualifier("iotRedisStream") |
|
|
|
|
|
private RedisStream iotRedisStream; |
|
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
|
@Qualifier("redisStream") |
|
|
private RedisStream redisStream; |
|
|
private RedisStream redisStream; |
|
|
|
|
|
|
|
|
@Resource |
|
|
@Resource |
|
@ -45,57 +49,98 @@ public class MessageSubscription implements CommandLineRunner { |
|
|
@Resource |
|
|
@Resource |
|
|
private DeviceFunctionReplyListener deviceFunctionReplyListener; |
|
|
private DeviceFunctionReplyListener deviceFunctionReplyListener; |
|
|
|
|
|
|
|
|
|
|
|
@Resource |
|
|
|
|
|
private TrafficGantryTransactionsListener trafficGantryTransactionsListener; |
|
|
|
|
|
|
|
|
|
|
|
@Resource |
|
|
|
|
|
private TrafficGantryPlatesListener trafficGantryPlatesListener; |
|
|
|
|
|
|
|
|
|
|
|
@Resource |
|
|
|
|
|
private TrafficTollStationEntranceListener trafficTollStationEntranceListener; |
|
|
|
|
|
|
|
|
|
|
|
@Resource |
|
|
|
|
|
private TrafficTollStationExitListener trafficTollStationExitListener; |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public void run(String... args) { |
|
|
public void run(String... args) { |
|
|
|
|
|
|
|
|
// 设备在线消息订阅
|
|
|
// 设备在线消息订阅
|
|
|
redisStream.subscriptionAutoAck( |
|
|
iotRedisStream.subscriptionAutoAck( |
|
|
RedisStreamConstants.DeviceOnline.KEY, |
|
|
RedisStreamConstants.DeviceOnline.KEY, |
|
|
RedisStreamConstants.DeviceOnline.GROUP, |
|
|
RedisStreamConstants.DeviceOnline.GROUP, |
|
|
RedisStreamConstants.DeviceOnline.CONSUMER, |
|
|
RedisStreamConstants.DeviceOnline.CONSUMER, |
|
|
onlineMessageListener); |
|
|
onlineMessageListener); |
|
|
|
|
|
|
|
|
// 离线消息订阅
|
|
|
// 离线消息订阅
|
|
|
redisStream.subscriptionAutoAck( |
|
|
iotRedisStream.subscriptionAutoAck( |
|
|
RedisStreamConstants.DeviceOffline.KEY, |
|
|
RedisStreamConstants.DeviceOffline.KEY, |
|
|
RedisStreamConstants.DeviceOffline.GROUP, |
|
|
RedisStreamConstants.DeviceOffline.GROUP, |
|
|
RedisStreamConstants.DeviceOffline.CONSUMER, |
|
|
RedisStreamConstants.DeviceOffline.CONSUMER, |
|
|
offlineMessageListener); |
|
|
offlineMessageListener); |
|
|
|
|
|
|
|
|
// 设备事件订阅
|
|
|
// 设备事件订阅
|
|
|
redisStream.subscriptionAutoAck( |
|
|
iotRedisStream.subscriptionAutoAck( |
|
|
RedisStreamConstants.DeviceEvent.KEY, |
|
|
RedisStreamConstants.DeviceEvent.KEY, |
|
|
RedisStreamConstants.DeviceEvent.GROUP, |
|
|
RedisStreamConstants.DeviceEvent.GROUP, |
|
|
RedisStreamConstants.DeviceEvent.CONSUMER, |
|
|
RedisStreamConstants.DeviceEvent.CONSUMER, |
|
|
deviceEventListener); |
|
|
deviceEventListener); |
|
|
|
|
|
|
|
|
// 设备属性上报消息订阅
|
|
|
// 设备属性上报消息订阅
|
|
|
redisStream.subscriptionAutoAck( |
|
|
iotRedisStream.subscriptionAutoAck( |
|
|
RedisStreamConstants.DevicePropertyReport.KEY, |
|
|
RedisStreamConstants.DevicePropertyReport.KEY, |
|
|
RedisStreamConstants.DevicePropertyReport.GROUP, |
|
|
RedisStreamConstants.DevicePropertyReport.GROUP, |
|
|
RedisStreamConstants.DevicePropertyReport.CONSUMER, |
|
|
RedisStreamConstants.DevicePropertyReport.CONSUMER, |
|
|
devicePropertyReportListener); |
|
|
devicePropertyReportListener); |
|
|
|
|
|
|
|
|
// 读取属性回复消息订阅
|
|
|
// 读取属性回复消息订阅
|
|
|
redisStream.subscriptionAutoAck( |
|
|
iotRedisStream.subscriptionAutoAck( |
|
|
RedisStreamConstants.DevicePropertyReadReply.KEY, |
|
|
RedisStreamConstants.DevicePropertyReadReply.KEY, |
|
|
RedisStreamConstants.DevicePropertyReadReply.GROUP, |
|
|
RedisStreamConstants.DevicePropertyReadReply.GROUP, |
|
|
RedisStreamConstants.DevicePropertyReadReply.CONSUMER, |
|
|
RedisStreamConstants.DevicePropertyReadReply.CONSUMER, |
|
|
devicePropertyReadReplyListener); |
|
|
devicePropertyReadReplyListener); |
|
|
|
|
|
|
|
|
// 写属性回复消息订阅
|
|
|
// 写属性回复消息订阅
|
|
|
redisStream.subscriptionAutoAck( |
|
|
iotRedisStream.subscriptionAutoAck( |
|
|
RedisStreamConstants.DevicePropertyWriteReply.KEY, |
|
|
RedisStreamConstants.DevicePropertyWriteReply.KEY, |
|
|
RedisStreamConstants.DevicePropertyWriteReply.GROUP, |
|
|
RedisStreamConstants.DevicePropertyWriteReply.GROUP, |
|
|
RedisStreamConstants.DevicePropertyWriteReply.CONSUMER, |
|
|
RedisStreamConstants.DevicePropertyWriteReply.CONSUMER, |
|
|
devicePropertyWriteReplyListener); |
|
|
devicePropertyWriteReplyListener); |
|
|
|
|
|
|
|
|
// 调用功能回复消息订阅
|
|
|
// 调用功能回复消息订阅
|
|
|
redisStream.subscriptionAutoAck( |
|
|
iotRedisStream.subscriptionAutoAck( |
|
|
RedisStreamConstants.DeviceFunctionReply.KEY, |
|
|
RedisStreamConstants.DeviceFunctionReply.KEY, |
|
|
RedisStreamConstants.DeviceFunctionReply.GROUP, |
|
|
RedisStreamConstants.DeviceFunctionReply.GROUP, |
|
|
RedisStreamConstants.DeviceFunctionReply.CONSUMER, |
|
|
RedisStreamConstants.DeviceFunctionReply.CONSUMER, |
|
|
deviceFunctionReplyListener); |
|
|
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); |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|