2
0
mirror of https://github.com/esiur/esiur-dotnet.git synced 2025-09-13 20:43:19 +00:00
This commit is contained in:
2025-08-12 12:25:07 +03:00
parent 531770820f
commit a490cb9e32
8 changed files with 106 additions and 962 deletions

View File

@@ -245,41 +245,41 @@ public class DistributedResource : DynamicObject, IResource, INotifyPropertyChan
return connection.SendInvoke(instanceId, index, args);
}
public AsyncReply Listen(EventTemplate et)
public AsyncReply Subscribe(EventTemplate et)
{
if (et == null)
return new AsyncReply().TriggerError(new AsyncException(ErrorType.Management, (ushort)ExceptionCode.MethodNotFound, ""));
if (!et.Listenable)
return new AsyncReply().TriggerError(new AsyncException(ErrorType.Management, (ushort)ExceptionCode.NotListenable, ""));
if (!et.Subscribable)
return new AsyncReply().TriggerError(new AsyncException(ErrorType.Management, (ushort)ExceptionCode.NotSubscribable, ""));
return connection.SendListenRequest(instanceId, et.Index);
}
public AsyncReply Listen(string eventName)
public AsyncReply Subscribe(string eventName)
{
var et = Instance.Template.GetEventTemplateByName(eventName);
return Listen(et);
return Subscribe(et);
}
public AsyncReply Unlisten(EventTemplate et)
public AsyncReply Unsubscribe(EventTemplate et)
{
if (et == null)
return new AsyncReply().TriggerError(new AsyncException(ErrorType.Management, (ushort)ExceptionCode.MethodNotFound, ""));
if (!et.Listenable)
if (!et.Subscribable)
return new AsyncReply().TriggerError(new AsyncException(ErrorType.Management, (ushort)ExceptionCode.NotListenable, ""));
return connection.SendUnlistenRequest(instanceId, et.Index);
}
public AsyncReply Unlisten(string eventName)
public AsyncReply Unsubscribe(string eventName)
{
var et = Instance.Template.GetEventTemplateByName(eventName);
return Unlisten(et);
return Unsubscribe(et);
}