From 6c806238b20ec2dd002ec844cf821c9ed2f00db7 Mon Sep 17 00:00:00 2001 From: Diego <2248356998@qq.com> Date: Wed, 5 Jun 2024 15:51:08 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20mqttRpc=E4=B8=BB=E9=A2=98=E7=AD=96?= =?UTF-8?q?=E7=95=A5=E6=9B=B4=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Break Changes mqttRpc主题策略更改 --- .../Cache/Interval/BusinessBaseWithCacheIntervalScript.cs | 6 +++--- .../Interval/BusinessPropertyWithCacheIntervalScript.cs | 8 ++++---- .../MqttClient/MqttClientProperty.cs | 2 +- .../TgMqttRpcClientTopicGenerationStrategy.cs | 2 +- .../MqttServer/MqttServerProperty.cs | 2 +- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/ThingsGateway.Gateway.Application/Plugin/Business/Cache/Interval/BusinessBaseWithCacheIntervalScript.cs b/src/ThingsGateway.Gateway.Application/Plugin/Business/Cache/Interval/BusinessBaseWithCacheIntervalScript.cs index 733f978a8..e8ae08902 100644 --- a/src/ThingsGateway.Gateway.Application/Plugin/Business/Cache/Interval/BusinessBaseWithCacheIntervalScript.cs +++ b/src/ThingsGateway.Gateway.Application/Plugin/Business/Cache/Interval/BusinessBaseWithCacheIntervalScript.cs @@ -78,7 +78,7 @@ public abstract partial class BusinessBaseWithCacheIntervalScript /// 设备Topic /// - [DynamicProperty] + [DynamicProperty(Remark = "可使用${key}作为匹配项,key必须是上传实体中的属性,比如ThingsGateway/Device/${Name}")] public string DeviceTopic { get; set; } = "ThingsGateway/Device"; /// /// 变量Topic /// - [DynamicProperty] + [DynamicProperty(Remark = "可使用${key}作为匹配项,key必须是上传实体中的属性,比如ThingsGateway/Variable/${DeviceName}")] public string VariableTopic { get; set; } = "ThingsGateway/Variable"; /// /// 报警Topic /// - [DynamicProperty] + [DynamicProperty(Remark = "可使用${key}作为匹配项,key必须是上传实体中的属性,比如ThingsGateway/Alarm/${DeviceName}")] public string AlarmTopic { get; set; } = "ThingsGateway/Alarm"; /// @@ -73,4 +73,4 @@ public class BusinessPropertyWithCacheIntervalScript : BusinessPropertyWithCache [DynamicProperty] [AutoGenerateColumn(ComponentType = typeof(Textarea), Rows = 1)] public string? BigTextScriptAlarmModel { get; set; } -} \ No newline at end of file +} diff --git a/src/adapter/ThingsGateway.Plugin.Mqtt/MqttClient/MqttClientProperty.cs b/src/adapter/ThingsGateway.Plugin.Mqtt/MqttClient/MqttClientProperty.cs index dc005176c..8c7cb0f8a 100644 --- a/src/adapter/ThingsGateway.Plugin.Mqtt/MqttClient/MqttClientProperty.cs +++ b/src/adapter/ThingsGateway.Plugin.Mqtt/MqttClient/MqttClientProperty.cs @@ -76,7 +76,7 @@ public class MqttClientProperty : BusinessPropertyWithCacheIntervalScript /// /// Rpc写入Topic /// - [DynamicProperty(Remark = "实际的写入主题为固定通配 {ThingsGateway.Rpc/+/[RpcWrite]} ,其中RpcWrite为该属性填入内容,+通配符是不固定GUID值,每次执行写入时会在不同的主题中返回;返回结果主题会在主题后添加Response , 也就是{ThingsGateway.Rpc/+/[RpcWrite]/Response}")] + [DynamicProperty(Remark = "实际的写入主题为固定通配 {RpcWrite/+} ,其中RpcWrite为该属性填入内容,+通配符是请求GUID值")] public string RpcWriteTopic { get diff --git a/src/adapter/ThingsGateway.Plugin.Mqtt/MqttNetRpcClass/TgMqttRpcClientTopicGenerationStrategy.cs b/src/adapter/ThingsGateway.Plugin.Mqtt/MqttNetRpcClass/TgMqttRpcClientTopicGenerationStrategy.cs index 9f24c13e9..531bfedcb 100644 --- a/src/adapter/ThingsGateway.Plugin.Mqtt/MqttNetRpcClass/TgMqttRpcClientTopicGenerationStrategy.cs +++ b/src/adapter/ThingsGateway.Plugin.Mqtt/MqttNetRpcClass/TgMqttRpcClientTopicGenerationStrategy.cs @@ -14,7 +14,7 @@ namespace ThingsGateway.Plugin.Mqtt; public sealed class TgMqttRpcClientTopicGenerationStrategy : IMqttRpcClientTopicGenerationStrategy { - public const string RpcTopic = "ThingsGateway.Rpc/+/{0}"; + public const string RpcTopic = "{0}/+"; public MqttRpcTopicPair CreateRpcTopics(TopicGenerationContext context) { diff --git a/src/adapter/ThingsGateway.Plugin.Mqtt/MqttServer/MqttServerProperty.cs b/src/adapter/ThingsGateway.Plugin.Mqtt/MqttServer/MqttServerProperty.cs index 6ff0c5b81..ba8bb63bf 100644 --- a/src/adapter/ThingsGateway.Plugin.Mqtt/MqttServer/MqttServerProperty.cs +++ b/src/adapter/ThingsGateway.Plugin.Mqtt/MqttServer/MqttServerProperty.cs @@ -52,7 +52,7 @@ public class MqttServerProperty : BusinessPropertyWithCacheIntervalScript /// /// Rpc写入Topic /// - [DynamicProperty(Remark = "实际的写入主题为固定通配 {ThingsGateway.Rpc/+/[RpcWrite]} ,其中RpcWrite为该属性填入内容,+通配符是不固定GUID值,每次执行写入时会在不同的主题中返回;返回结果主题会在主题后添加Response , 也就是{ThingsGateway.Rpc/+/[RpcWrite]/Response}")] + [DynamicProperty(Remark = "实际的写入主题为固定通配 {RpcWrite/+} ,其中RpcWrite为该属性填入内容,+通配符是请求GUID值;返回结果主题会在主题后添加Response , 也就是{RpcWrite/+/Response}")] public string RpcWriteTopic { get