Commit e5417d6ce5161ebf7df4921cf77bc5540edd9fcc

Authored by xp.Huang
1 parent ca3143a5

perf: 调整gbt28181条件式加载,默认为false

... ... @@ -4,6 +4,7 @@ import com.fasterxml.jackson.databind.JsonNode;
4 4 import lombok.Getter;
5 5 import lombok.extern.slf4j.Slf4j;
6 6 import org.springframework.beans.factory.annotation.Value;
  7 +import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression;
7 8 import org.springframework.stereotype.Component;
8 9 import org.thingsboard.server.common.data.id.EntityId;
9 10 import org.thingsboard.server.common.data.yunteng.config.media.ZLMediaKitServerConfig;
... ... @@ -24,6 +25,8 @@ import java.util.Optional;
24 25
25 26 @Component("ZLMediaKitState")
26 27 @TbCoreComponent
  28 +@ConditionalOnExpression(
  29 + "'${service.type:null}'=='tb-transport' || ('${service.type:null}'=='monolith' && '${transport.api_enabled:true}'=='true' && '${transport.gbt28181.enabled}'=='true')")
27 30 @Slf4j
28 31 public class ZLMediaKitStateRunner {
29 32 private final ZLMediaKitRestFulUtils zlMediaKitRestFulUtils;
... ...
... ... @@ -720,7 +720,7 @@ transport:
720 720 # Local CoAP transport parameters
721 721 gbt28181:
722 722 # Enable/disable gbt28181 transport protocol.
723   - enabled: "${GBT28181_ENABLED:true}"
  723 + enabled: "${GBT28181_ENABLED:false}"
724 724 tcp:
725 725 # Enable/disable tcp transport protocol.
726 726 enabled: "${TCP_ENABLED:true}"
... ... @@ -1232,7 +1232,7 @@ sip:
1232 1232 # 如果要监听多张网卡,可以使用逗号分隔多个IP, 例如: 192.168.1.4,10.0.0.4
1233 1233 # 如果不明白,就使用0.0.0.0,大部分情况都是可以的
1234 1234 # 请不要使用127.0.0.1,任何包括localhost在内的域名都是不可以的。
1235   - ip: ${GBT28181_SIP_IP:192.168.1.15}
  1235 + ip: ${GBT28181_SIP_IP:127.0.0.1}
1236 1236 # [可选] 28181服务监听的端口
1237 1237 port: ${GBT28181_SIP_PORT:5060}
1238 1238 #[可选]
... ... @@ -1248,7 +1248,7 @@ sip:
1248 1248 media:
1249 1249 id: ${GBT28181_MEDIA_GENERAL_ID:D2okJWKKaQ5bX7Va}
1250 1250 # [必须修改] zlm服务器的内网IP
1251   - ip: ${GBT28181_MEDIA_IP:192.168.1.20}
  1251 + ip: ${GBT28181_MEDIA_IP:127.0.0.1}
1252 1252 # [必须修改] zlm服务器的http.port
1253 1253 http-port: ${GBT28181_MEDIA_HTTP_PORT:28080}
1254 1254 # [可选] zlm服务器的hook.admin_params=secret
... ...
... ... @@ -15,8 +15,6 @@ import org.thingsboard.server.common.data.yunteng.enums.SessionTypeEnum;
15 15 /** 视频流session管理器,管理视频预览、预览回放的通信句柄 */
16 16 @Component
17 17 @Slf4j
18   -@ConditionalOnExpression(
19   - "'${service.type:null}'=='tb-transport' || ('${service.type:null}'=='monolith' && '${transport.api_enabled:true}'=='true' && '${transport.gbt28181.enabled}'=='true')")
20 18 public class VideoStreamSessionManager {
21 19
22 20 @Autowired private UserSetting userSetting;
... ...
... ... @@ -11,7 +11,6 @@ import javax.sip.message.Request;
11 11 import javax.sip.message.Response;
12 12 import lombok.extern.slf4j.Slf4j;
13 13 import org.springframework.beans.factory.annotation.Autowired;
14   -import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression;
15 14 import org.springframework.stereotype.Component;
16 15 import org.springframework.util.ObjectUtils;
17 16 import org.thingsboard.server.common.data.yunteng.config.media.ThingsKitVersionConfig;
... ... @@ -21,8 +20,6 @@ import org.thingsboard.server.transport.util.TKSipUtils;
21 20
22 21 /** 发送SIP信息 */
23 22 @Component
24   -@ConditionalOnExpression(
25   - "'${service.type:null}'=='tb-transport' || ('${service.type:null}'=='monolith' && '${transport.api_enabled:true}'=='true' && '${transport.gbt28181.enabled}'=='true')")
26 23 @Slf4j
27 24 public class SIPSender {
28 25
... ...
... ... @@ -10,15 +10,12 @@ import javax.sip.address.AddressFactory;
10 10 import javax.sip.address.SipURI;
11 11 import javax.sip.header.*;
12 12 import org.springframework.beans.factory.annotation.Autowired;
13   -import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression;
14 13 import org.springframework.stereotype.Component;
15 14 import org.thingsboard.server.common.data.yunteng.config.media.SipConfig;
16 15 import org.thingsboard.server.common.data.yunteng.config.media.ThingsKitVersionConfig;
17 16 import org.thingsboard.server.transport.gbt28181.SipLayer;
18 17
19 18 @Component
20   -@ConditionalOnExpression(
21   - "'${service.type:null}'=='tb-transport' || ('${service.type:null}'=='monolith' && '${transport.api_enabled:true}'=='true' && '${transport.gbt28181.enabled}'=='true')")
22 19 public class AbstractSIPRequestProcess {
23 20 @Autowired private SipConfig sipConfig;
24 21 @Autowired protected ThingsKitVersionConfig thingsKitVersionConfig;
... ...
... ... @@ -15,15 +15,12 @@ import javax.sip.address.SipURI;
15 15 import javax.sip.header.*;
16 16 import javax.sip.message.Request;
17 17 import javax.sip.message.Response;
18   -import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression;
19 18 import org.springframework.stereotype.Component;
20 19 import org.thingsboard.server.common.data.yunteng.dto.sip.SipMessageHeaderDTO;
21 20 import org.thingsboard.server.transport.session.GbtDeviceSessionCtx;
22 21 import org.thingsboard.server.transport.util.TKSipUtils;
23 22
24 23 @Component
25   -@ConditionalOnExpression(
26   - "'${service.type:null}'=='tb-transport' || ('${service.type:null}'=='monolith' && '${transport.api_enabled:true}'=='true' && '${transport.gbt28181.enabled}'=='true')")
27 24 public class SIPRequestHeaderProcess extends AbstractSIPRequestProcess {
28 25 public Request createMessageRequest(
29 26 GbtDeviceSessionCtx sessionCtx,
... ...
... ... @@ -6,12 +6,15 @@ import org.slf4j.Logger;
6 6 import org.slf4j.LoggerFactory;
7 7 import org.springframework.beans.factory.InitializingBean;
8 8 import org.springframework.beans.factory.annotation.Autowired;
  9 +import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression;
9 10 import org.springframework.stereotype.Component;
10 11 import org.thingsboard.server.transport.gbt28181.ITimeoutProcessor;
11 12 import org.thingsboard.server.transport.SIPProcessorObserver;
12 13 import org.thingsboard.server.transport.gbt28181.SipSubscribe;
13 14
14 15 @Component
  16 +@ConditionalOnExpression(
  17 + "'${service.type:null}'=='tb-transport' || ('${service.type:null}'=='monolith' && '${transport.api_enabled:true}'=='true' && '${transport.gbt28181.enabled}'=='true')")
15 18 public class TimeoutProcessorImpl implements InitializingBean, ITimeoutProcessor {
16 19
17 20 private Logger logger = LoggerFactory.getLogger(TimeoutProcessorImpl.class);
... ...