添加消息到 Stream 的函数,

RedisConstant增加变量
This commit is contained in:
duwenyuan 2025-09-28 10:54:11 +08:00
parent 167f3dd19b
commit 23b5e3e375
2 changed files with 19 additions and 0 deletions

View File

@ -41,4 +41,14 @@ public interface RedisConstant {
String EMAIL_MSG_ID = "email_msg_id";
String UNDEAL_FILE = "Undeal:";
//自动分析等级
String AUTO_CAT = "Stream:AutoCat";
String GROUP_AutoCat = "Group_AutoCat";
String AUTO_CONSUMER = "AutoCat_Consumer";
//人工交互等级
String CATEGORY = "Stream:Category";
String GROUP_Category = "Group_Category";
String CATEGORY_CONSUMER = "Category_Consumer";
}

View File

@ -198,6 +198,15 @@ public class RedisStreamUtil {
// 向Redis Stream中推送消息
return putRecord(record);
}
/**
* 添加消息到 Stream (对象格式)
*/
public <T> RecordId addMessage(String streamKey, T message) {
ObjectRecord<String, T> record = StreamRecords.newRecord()
.in(streamKey)
.ofObject(message);
return stringRedisTemplate.opsForStream().add(record);
}
public void setSilence(Map<String, Long> silenceMap){
// 返回批处理的执行结果