Skip to content

Conversation

@EachannChan
Copy link
Contributor

No description provided.

public void serializeBody(Object object) {
HessianSerializer serializer = new HessianSerializer();
try {
this.body = serializer.serialize(object);
Copy link
Collaborator

@yanhom1314 yanhom1314 Aug 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

我理解common包里不需要引入sofa的包吧。序列化、反序列化应该是sofa框架内部做的,不需要我们自己做,这儿应该就是个简单的request bean

<dependency>
<groupId>com.alipay.sofa.common</groupId>
<artifactId>sofa-common-tools</artifactId>
<version>${sofa-common-tools.version}</version>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sofa-common-tools 是不在sofa-bolt里引入了,需要单独引入吗

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

文档里说是得单独引入,然后admin端的话有报错,应该是手脚架的日志框架相关版本太高了,这个sofa-common-tools的太低了,到时还要解决一下

<!-- <artifactId>maven-gpg-plugin</artifactId>-->
<!-- <version>1.6</version>-->
<!-- <executions>-->
<!-- <execution>-->
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pr里注释的这些恢复吧

example/pom.xml Outdated
<!-- <module>example-adapter</module>-->
<module>example-polaris-cloud</module>
<module>example-huawei-cloud</module>
<!-- <module>example-admin</module>-->
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

注释的恢复

sdk/pom.xml Outdated
<version>${revision}</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>dynamic-tp-sdk</artifactId>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sdk module 改为 client吧,更规范点

AdminRequestBody requestBody = new AdminRequestBody(SNOWFLAKE_GENERATOR.next(), requestType);
Object object = null;
try {
client.invokeSync(connection, attributeRequestBody, 5000);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

多写了一行?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个是为了传attribute属性像是clientName过去给Admin端,本来是想通过Connection来传输的,但是Admin拿不到就用这种方式实现了。就相当于在每次请求时向admin更新attribute

Copy link
Collaborator

@yanhom1314 yanhom1314 Aug 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

没懂为啥要分两个请求呢,直接在AdminRequestBody里加上clientName字段不行吗。这看着很不合理

public void collectAllPoolStats() {
try {
Set<String> executorNames = DtpRegistry.getAllExecutorNames();
if (executorNames.isEmpty()) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

参考DtpEndpoint ,adapter的指标也采集下。这个是不是用DtpMonitor定时采集上报更好点呢?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

我实现下。这里应该是前端整了个定时刷新的机制,现在也有定时采集的

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

写个MetricsCollector,spi装载进去就行了

common/pom.xml Outdated
<dependency>
<groupId>com.alipay.sofa</groupId>
<artifactId>bolt</artifactId>
</dependency>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

common 不要引入其他三方中间件依赖,保持common干净简洁

* @author eachann
*/
public class AttributeRequestBody implements Serializable {

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个类好像存在的必要性不大啊,AdminRequestBody本身就是做请求体封装的

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

那我去掉吧

@RestController
@AllArgsConstructor
public class TestController {

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个example好像就是复制了一份nacos的出来,并没有测试连接admin测试啊,可以优化下,不必要的删除下,配置admin的地址能正常跑起来。


private final int adminPort = 8989;

private final Url adminUrl = new Url(adminIp, adminPort);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

client 怎么连接 admin 的地址,好像没看到配置的

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

client的地址是随机取的,这里配置不了。我把admin的端口暴露一下吧

@Configuration
@AutoConfigureAfter({DtpBaseBeanConfiguration.class})
@ConditionalOnClass(name = "com.qq.tars.client.Communicator")
@ConditionalOnClass(name = "com.qq.tars.adminclient.Communicator")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

多改了。。。

public class AdminClient {

private final String adminIp = "127.0.0.1";
@Value("${dynamictp.adminIp:127.0.0.1}")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个是不得支持集群啊,多个ip,建立多个连接,搞个负载均衡策略拿连接

*/

package org.dromara.dynamictp.sdk.client.handler.refresh;
package org.dromara.dynamictp.client.adminclient.handler.refresh;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

adminclient,感觉这个包可以去掉

}
AttributeRequestBody attributeRequestBody = new AttributeRequestBody();
attributeRequestBody.setAttribute("clientName", clientName);
AdminRequestBody attributeRequestBody = new AdminRequestBody(SNOWFLAKE_GENERATOR.next(), AdminRequestTypeEnum.ATTRIBUTE);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

如果必要,clientName 是不可以直接作为 AdminRequestBody 中的一个字段呢,单开一个map好像有点啰嗦

@EachannChan EachannChan changed the base branch from master to dev October 18, 2025 11:14
@yanhom1314 yanhom1314 merged commit 7f0ec8f into dromara:dev Oct 19, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants