Browse Source

去除一些无用代码

develop
xiepufeng 6 months ago
parent
commit
19101e1df7
  1. 37
      zc-business/src/main/java/com/zc/business/constant/RedisStreamConstants.java
  2. 29
      zc-business/src/main/java/com/zc/business/message/device/listener/TrafficGantryPlatesListener.java
  3. 29
      zc-business/src/main/java/com/zc/business/message/device/listener/TrafficGantryTransactionsListener.java
  4. 29
      zc-business/src/main/java/com/zc/business/message/device/listener/TrafficTollStationEntranceListener.java
  5. 29
      zc-business/src/main/java/com/zc/business/message/device/listener/TrafficTollStationExitListener.java
  6. 41
      zc-business/src/main/java/com/zc/business/message/device/subscribe/MessageSubscription.java

37
zc-business/src/main/java/com/zc/business/constant/RedisStreamConstants.java

@ -69,41 +69,4 @@ public class RedisStreamConstants {
public final static String CONSUMER = "consumer1";
}
/**
* 门架交易流水
*/
public static class TrafficGantryTransactions {
public final static String KEY = "traffic:gantry:transactions";
public final static String GROUP = "group1";
public final static String CONSUMER = "consumer1";
}
/**
* 门架牌识
*/
public static class TrafficGantryPlates {
public final static String KEY = "traffic:gantry:plates";
public final static String GROUP = "group1";
public final static String CONSUMER = "consumer1";
}
/**
* 收费入口数据
*/
public static class TrafficTollStationEntrance {
public final static String KEY = "traffic:tollStation:entrance";
public final static String GROUP = "group1";
public final static String CONSUMER = "consumer1";
}
/**
* 收费出口数据
*/
public static class TrafficTollStationExit {
public final static String KEY = "traffic:tollStation:exit";
public final static String GROUP = "group1";
public final static String CONSUMER = "consumer1";
}
}

29
zc-business/src/main/java/com/zc/business/message/device/listener/TrafficGantryPlatesListener.java

@ -1,29 +0,0 @@
package com.zc.business.message.device.listener;
import com.zc.common.core.redis.stream.RedisStream;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.data.redis.connection.stream.ObjectRecord;
import org.springframework.data.redis.connection.stream.RecordId;
import org.springframework.data.redis.stream.StreamListener;
import org.springframework.stereotype.Component;
/**
* 门架牌识
*/
@Component
public class TrafficGantryPlatesListener implements StreamListener<String, ObjectRecord<String, String>>
{
@Autowired
@Qualifier("iotRedisStream")
private RedisStream redisStream;
@Override
public void onMessage(ObjectRecord<String, String> message) {
String streamKay = message.getStream();
RecordId recordId = message.getId();
// 消费完后直接删除消息
redisStream.del(streamKay, String.valueOf(recordId));
}
}

29
zc-business/src/main/java/com/zc/business/message/device/listener/TrafficGantryTransactionsListener.java

@ -1,29 +0,0 @@
package com.zc.business.message.device.listener;
import com.zc.common.core.redis.stream.RedisStream;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.data.redis.connection.stream.ObjectRecord;
import org.springframework.data.redis.connection.stream.RecordId;
import org.springframework.data.redis.stream.StreamListener;
import org.springframework.stereotype.Component;
/**
* 门架交易流水消息监听
*/
@Component
public class TrafficGantryTransactionsListener implements StreamListener<String, ObjectRecord<String, String>>
{
@Autowired
@Qualifier("iotRedisStream")
private RedisStream redisStream;
@Override
public void onMessage(ObjectRecord<String, String> message) {
String streamKay = message.getStream();
RecordId recordId = message.getId();
// 消费完后直接删除消息
redisStream.del(streamKay, String.valueOf(recordId));
}
}

29
zc-business/src/main/java/com/zc/business/message/device/listener/TrafficTollStationEntranceListener.java

@ -1,29 +0,0 @@
package com.zc.business.message.device.listener;
import com.zc.common.core.redis.stream.RedisStream;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.data.redis.connection.stream.ObjectRecord;
import org.springframework.data.redis.connection.stream.RecordId;
import org.springframework.data.redis.stream.StreamListener;
import org.springframework.stereotype.Component;
/**
* 收费入口数据
*/
@Component
public class TrafficTollStationEntranceListener implements StreamListener<String, ObjectRecord<String, String>>
{
@Autowired
@Qualifier("iotRedisStream")
private RedisStream redisStream;
@Override
public void onMessage(ObjectRecord<String, String> message) {
String streamKay = message.getStream();
RecordId recordId = message.getId();
// 消费完后直接删除消息
redisStream.del(streamKay, String.valueOf(recordId));
}
}

29
zc-business/src/main/java/com/zc/business/message/device/listener/TrafficTollStationExitListener.java

@ -1,29 +0,0 @@
package com.zc.business.message.device.listener;
import com.zc.common.core.redis.stream.RedisStream;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.data.redis.connection.stream.ObjectRecord;
import org.springframework.data.redis.connection.stream.RecordId;
import org.springframework.data.redis.stream.StreamListener;
import org.springframework.stereotype.Component;
/**
* 收费出口数据
*/
@Component
public class TrafficTollStationExitListener implements StreamListener<String, ObjectRecord<String, String>>
{
@Autowired
@Qualifier("iotRedisStream")
private RedisStream redisStream;
@Override
public void onMessage(ObjectRecord<String, String> message) {
String streamKay = message.getStream();
RecordId recordId = message.getId();
// 消费完后直接删除消息
redisStream.del(streamKay, String.valueOf(recordId));
}
}

41
zc-business/src/main/java/com/zc/business/message/device/subscribe/MessageSubscription.java

@ -49,18 +49,6 @@ 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) {
@ -113,34 +101,5 @@ public class MessageSubscription implements CommandLineRunner {
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);
}
}

Loading…
Cancel
Save