[集群] 优化国标级联目录更新
This commit is contained in:
@@ -4,6 +4,7 @@ import com.genersoft.iot.vmp.common.CommonCallback;
|
||||
import com.genersoft.iot.vmp.common.StreamInfo;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.Platform;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.SendRtpInfo;
|
||||
import com.genersoft.iot.vmp.gb28181.event.subscribe.catalog.CatalogEvent;
|
||||
import com.genersoft.iot.vmp.vmanager.bean.WVPResult;
|
||||
|
||||
import java.util.List;
|
||||
@@ -33,5 +34,5 @@ public interface IRedisRpcService {
|
||||
|
||||
boolean updatePlatform(String serverId, Platform platform);
|
||||
|
||||
void catalogEventPublish(String serverId, Integer platformId, List<Integer> channelIds, String type);
|
||||
void catalogEventPublish(String serverId, CatalogEvent catalogEvent);
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@ import com.genersoft.iot.vmp.conf.redis.bean.RedisRpcResponse;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.CommonGBChannel;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.Platform;
|
||||
import com.genersoft.iot.vmp.gb28181.event.EventPublisher;
|
||||
import com.genersoft.iot.vmp.gb28181.event.subscribe.catalog.CatalogEvent;
|
||||
import com.genersoft.iot.vmp.gb28181.service.IPlatformChannelService;
|
||||
import com.genersoft.iot.vmp.gb28181.service.IPlatformService;
|
||||
import com.genersoft.iot.vmp.service.redisMsg.dto.RedisRpcController;
|
||||
@@ -70,21 +71,9 @@ public class RedisRpcPlatformController extends RpcController {
|
||||
*/
|
||||
@RedisRpcMapping("catalogEventPublish")
|
||||
public RedisRpcResponse catalogEventPublish(RedisRpcRequest request) {
|
||||
JSONObject jsonObject = JSONObject.parseObject(request.getParam().toString());
|
||||
int platformId = jsonObject.getIntValue("platformId");
|
||||
Integer[] channelIds = jsonObject.getJSONArray("channelIds").toArray(Integer.class);
|
||||
String type = jsonObject.getString("type");
|
||||
CatalogEvent event = JSONObject.parseObject(request.getParam().toString(), CatalogEvent.class);
|
||||
eventPublisher.catalogEventPublish(event);
|
||||
RedisRpcResponse response = request.getResponse();
|
||||
|
||||
Platform platform = platformService.queryOne(platformId);
|
||||
if (platform == null ) {
|
||||
log.warn("[]");
|
||||
response.setStatusCode(ErrorCode.ERROR400.getCode());
|
||||
response.setBody(ErrorCode.ERROR400.getMsg());
|
||||
return response;
|
||||
}
|
||||
List<CommonGBChannel> commonGBChannels = platformChannelService.queryChannelByPlatformIdAndChannelIds(platformId, Arrays.asList(channelIds));
|
||||
eventPublisher.catalogEventPublish(platform, commonGBChannels, type);
|
||||
response.setStatusCode(ErrorCode.SUCCESS.getCode());
|
||||
return response;
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ import com.genersoft.iot.vmp.conf.redis.bean.RedisRpcRequest;
|
||||
import com.genersoft.iot.vmp.conf.redis.bean.RedisRpcResponse;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.Platform;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.SendRtpInfo;
|
||||
import com.genersoft.iot.vmp.gb28181.event.subscribe.catalog.CatalogEvent;
|
||||
import com.genersoft.iot.vmp.gb28181.session.SSRCFactory;
|
||||
import com.genersoft.iot.vmp.media.event.hook.Hook;
|
||||
import com.genersoft.iot.vmp.media.event.hook.HookSubscribe;
|
||||
@@ -234,13 +235,11 @@ public class RedisRpcServiceImpl implements IRedisRpcService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void catalogEventPublish(String serverId, Integer platformId, List<Integer> channelIds, String type) {
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("platformId", platformId);
|
||||
jsonObject.put("channelIds", channelIds);
|
||||
jsonObject.put("type", type);
|
||||
RedisRpcRequest request = buildRequest("platform/catalogEventPublish", jsonObject);
|
||||
request.setToId(serverId);
|
||||
public void catalogEventPublish(String serverId, CatalogEvent event) {
|
||||
RedisRpcRequest request = buildRequest("platform/catalogEventPublish", event);
|
||||
if (serverId != null) {
|
||||
request.setToId(serverId);
|
||||
}
|
||||
redisRpcConfig.request(request, 100);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user