增加广播ID , 对于自身广播不做处理

v1.4.1
Parker 5 years ago
parent 72cd13c3f0
commit d15c66c1fe

@ -0,0 +1,25 @@
package org.opsli.core.cache.pushsub.entity;
import lombok.Data;
import org.opsli.core.cache.pushsub.enums.PushSubType;
/**
* @BelongsProject: opsli-boot
* @BelongsPackage: org.opsli.core.cache.pushsub.entity
* @Author: Parker
* @CreateTime: 2020-09-18 00:01
* @Description: Entity
*/
@Data
public class CacheDataEntity {
/** key */
private String key;
/** 数据类型 */
private PushSubType type;
/** 缓存名称 */
private String cacheName;
}

@ -30,7 +30,7 @@ public class EdenDataHandler implements RedisPushSubHandler{
// 缓存更新
if(CacheType.UPDATE == type){
CacheUtil.putByEden(key, value);
CacheUtil.putEdenByKeyOriginal(key, value);
}
// 缓存删除
else if(CacheType.DELETE == type){

@ -30,7 +30,7 @@ public class HotDataHandler implements RedisPushSubHandler{
// 缓存更新
if(CacheType.UPDATE == type){
CacheUtil.put(key, value);
CacheUtil.putByKeyOriginal(key, value);
}
// 缓存删除
else if(CacheType.DELETE == type){

@ -2,6 +2,7 @@ package org.opsli.core.cache.pushsub.receiver;
import com.alibaba.fastjson.JSONObject;
import lombok.extern.slf4j.Slf4j;
import org.opsli.common.enums.SystemInfo;
import org.opsli.common.utils.PackageUtil;
import org.opsli.core.cache.pushsub.enums.PushSubType;
import org.opsli.core.cache.pushsub.handler.RedisPushSubHandler;
@ -98,6 +99,11 @@ public class RedisPushSubReceiver extends BaseReceiver {
String substring = replaceAll.substring(1, replaceAll.length() - 1);
JSONObject msgJson = JSONObject.parseObject(substring);
String type = (String) msgJson.get(BaseSubMessage.BASE_TYPE);
String identifier = (String) msgJson.get(BaseSubMessage.BASE_ID);
// 本机不广播
if(SystemInfo.INSTANCE.getSystemID().equals(identifier)){
return;
}
PushSubType pt = PushSubType.valueOf(type);
RedisPushSubHandler redisPushSubHandler = HANDLER_MAP.get(pt);
if(redisPushSubHandler == null){

Loading…
Cancel
Save