Skip to content

Commit

Permalink
[type:feature] add client heartbeat, debug
Browse files Browse the repository at this point in the history
  • Loading branch information
Aias00 committed Sep 18, 2024
1 parent 9d879be commit ec160dc
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 3 deletions.
1 change: 1 addition & 0 deletions shenyu-admin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>compile</scope>
</dependency>

<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@
import org.apache.shenyu.common.enums.MatchModeEnum;
import org.apache.shenyu.common.enums.SelectorTypeEnum;
import org.apache.shenyu.common.utils.ContextPathUtils;
import org.apache.shenyu.common.utils.GsonUtils;
import org.apache.shenyu.common.utils.JsonUtils;
import org.apache.shenyu.common.utils.ListUtil;
import org.apache.shenyu.register.common.dto.MetaDataRegisterDTO;
Expand Down Expand Up @@ -168,6 +169,7 @@ public String registerDefault(final SelectorDTO selectorDTO) {
selectorMapper.insertSelective(selectorDO);
createCondition(selectorDO.getId(), selectorDTO.getSelectorConditions());
}
LOG.info("publish selector register event: {}", GsonUtils.getInstance().toJson(selectorDO));
publishEvent(selectorDO, selectorDTO.getSelectorConditions(), Collections.emptyList());
return selectorDO.getId();
}
Expand Down Expand Up @@ -205,6 +207,7 @@ public int create(final SelectorDTO selectorDTO) {
final int selectorCount = selectorMapper.insertSelective(selectorDO);
selectorDTO.setId(selectorDO.getId());
createCondition(selectorDO.getId(), selectorDTO.getSelectorConditions());
LOG.info("publish selector create event: {}", GsonUtils.getInstance().toJson(selectorDO));
publishEvent(selectorDO, selectorDTO.getSelectorConditions(), Collections.emptyList());
if (selectorCount > 0) {
selectorEventPublisher.onCreated(selectorDO);
Expand Down Expand Up @@ -244,6 +247,7 @@ public int update(final SelectorDTO selectorDTO) {
//delete rule condition then add
selectorConditionMapper.deleteByQuery(new SelectorConditionQuery(selectorDO.getId()));
createCondition(selectorDO.getId(), selectorDTO.getSelectorConditions());
LOG.info("publish selector update event: {}", GsonUtils.getInstance().toJson(selectorDO));
publishEvent(selectorDO, selectorDTO.getSelectorConditions(), beforeSelectorConditionList);
if (selectorCount > 0) {
selectorEventPublisher.onUpdated(selectorDO, before);
Expand Down
2 changes: 1 addition & 1 deletion shenyu-admin/src/main/resources/application-mysql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ spring:
datasource:
url: jdbc:mysql://localhost:3306/shenyu?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=Asia/Shanghai&zeroDateTimeBehavior=convertToNull
username: root
password: 12345678
password: passwd4mysql
driver-class-name: com.mysql.cj.jdbc.Driver
hikari:
connection-timeout: 30000
Expand Down
4 changes: 2 additions & 2 deletions shenyu-admin/src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ shenyu:
props:
sessionTimeout: 5000
connectionTimeout: 2000
checked: true
checked: false
zombieCheckThreads: 10
zombieCheckTimes: 5
scheduledTime: 10
Expand Down Expand Up @@ -222,5 +222,5 @@ logging:
org.apache.ibatis: info
org.apache.shenyu.bonuspoint: info
org.apache.shenyu.lottery: info
org.apache.shenyu: info
org.apache.shenyu: debug
# org.apache.shenyu.admin.utils.HttpUtils: debug

0 comments on commit ec160dc

Please sign in to comment.