refactor: mqttRpc主题策略更改

Break Changes

mqttRpc主题策略更改
This commit is contained in:
Diego
2024-06-05 15:51:08 +08:00
parent ea6e07a38b
commit 6c806238b2
5 changed files with 10 additions and 10 deletions

View File

@@ -78,7 +78,7 @@ public abstract partial class BusinessBaseWithCacheIntervalScript<VarModel, DevM
// 将主题中的占位符替换为分组键对应的值
for (int i = 0; i < topics.Count; i++)
{
topic = topic.Replace(@"${" + topics[i] + @"}", group.Key[i].ToString());
topic = topic.Replace(@"${" + topics[i] + @"}", group.Key[i]?.ToString());
}
// 上传内容
@@ -143,7 +143,7 @@ public abstract partial class BusinessBaseWithCacheIntervalScript<VarModel, DevM
// 将主题中的占位符替换为分组键对应的值
for (int i = 0; i < topics.Count; i++)
{
topic = topic.Replace(@"${" + topics[i] + @"}", group.Key[i].ToString());
topic = topic.Replace(@"${" + topics[i] + @"}", group.Key[i]?.ToString());
}
// 上传内容
@@ -208,7 +208,7 @@ public abstract partial class BusinessBaseWithCacheIntervalScript<VarModel, DevM
// 将主题中的占位符替换为分组键对应的值
for (int i = 0; i < topics.Count; i++)
{
topic = topic.Replace(@"${" + topics[i] + @"}", group.Key[i].ToString());
topic = topic.Replace(@"${" + topics[i] + @"}", group.Key[i]?.ToString());
}
// 上传内容

View File

@@ -38,19 +38,19 @@ public class BusinessPropertyWithCacheIntervalScript : BusinessPropertyWithCache
/// <summary>
/// 设备Topic
/// </summary>
[DynamicProperty]
[DynamicProperty(Remark = "可使用${key}作为匹配项key必须是上传实体中的属性比如ThingsGateway/Device/${Name}")]
public string DeviceTopic { get; set; } = "ThingsGateway/Device";
/// <summary>
/// 变量Topic
/// </summary>
[DynamicProperty]
[DynamicProperty(Remark = "可使用${key}作为匹配项key必须是上传实体中的属性比如ThingsGateway/Variable/${DeviceName}")]
public string VariableTopic { get; set; } = "ThingsGateway/Variable";
/// <summary>
/// 报警Topic
/// </summary>
[DynamicProperty]
[DynamicProperty(Remark = "可使用${key}作为匹配项key必须是上传实体中的属性比如ThingsGateway/Alarm/${DeviceName}")]
public string AlarmTopic { get; set; } = "ThingsGateway/Alarm";
/// <summary>
@@ -73,4 +73,4 @@ public class BusinessPropertyWithCacheIntervalScript : BusinessPropertyWithCache
[DynamicProperty]
[AutoGenerateColumn(ComponentType = typeof(Textarea), Rows = 1)]
public string? BigTextScriptAlarmModel { get; set; }
}
}

View File

@@ -76,7 +76,7 @@ public class MqttClientProperty : BusinessPropertyWithCacheIntervalScript
/// <summary>
/// Rpc写入Topic
/// </summary>
[DynamicProperty(Remark = "实际的写入主题为固定通配 {ThingsGateway.Rpc/+/[RpcWrite]} ,RpcWrite为该属性填入内容+GUID值Response , {ThingsGateway.Rpc/+/[RpcWrite]/Response}")]
[DynamicProperty(Remark = "实际的写入主题为固定通配 {RpcWrite/+} 其中RpcWrite为该属性填入内容+通配符是请求GUID值")]
public string RpcWriteTopic
{
get

View File

@@ -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)
{

View File

@@ -52,7 +52,7 @@ public class MqttServerProperty : BusinessPropertyWithCacheIntervalScript
/// <summary>
/// Rpc写入Topic
/// </summary>
[DynamicProperty(Remark = "实际的写入主题为固定通配 {ThingsGateway.Rpc/+/[RpcWrite]} ,RpcWrite为该属性填入内容+GUID值Response , {ThingsGateway.Rpc/+/[RpcWrite]/Response}")]
[DynamicProperty(Remark = "实际的写入主题为固定通配 {RpcWrite/+} 其中RpcWrite为该属性填入内容+通配符是请求GUID值返回结果主题会在主题后添加Response , 也就是{RpcWrite/+/Response}")]
public string RpcWriteTopic
{
get