mirror of
https://gitee.com/ThingsGateway/ThingsGateway.git
synced 2025-10-24 20:28:59 +08:00
refactor: mqttRpc主题策略更改
Break Changes mqttRpc主题策略更改
This commit is contained in:
@@ -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());
|
||||
}
|
||||
|
||||
// 上传内容
|
||||
|
||||
@@ -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; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user