xiepufeng
7 months ago
6 changed files with 206 additions and 7 deletions
@ -0,0 +1,29 @@ |
|||
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)); |
|||
} |
|||
} |
@ -0,0 +1,29 @@ |
|||
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)); |
|||
} |
|||
} |
@ -0,0 +1,29 @@ |
|||
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)); |
|||
} |
|||
} |
@ -0,0 +1,29 @@ |
|||
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)); |
|||
} |
|||
} |
Loading…
Reference in new issue