-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
合同接口(IpcContract)支持事件 #12
Labels
enhancement
New feature or request
Comments
Closed
DingpingZhang
added a commit
that referenced
this issue
Aug 10, 2021
DingpingZhang
added a commit
that referenced
this issue
Aug 15, 2021
DingpingZhang
added a commit
that referenced
this issue
Sep 2, 2021
DingpingZhang
added a commit
that referenced
this issue
Sep 2, 2021
DingpingZhang
added a commit
that referenced
this issue
Nov 15, 2021
DingpingZhang
added a commit
that referenced
this issue
Nov 15, 2021
DingpingZhang
added a commit
that referenced
this issue
Nov 15, 2021
DingpingZhang
added a commit
that referenced
this issue
Nov 16, 2021
DingpingZhang
added a commit
that referenced
this issue
Nov 17, 2021
关于事件的实现,有两种方案:同步和异步。 1. 同步即当 Client 调用 Raise Event 方法时,该方法被阻塞,直到所有订阅了该事件的 Handler (可能存在于多个进程内)全部执行完毕,才会返回。 优点:
缺点:
2. 异步即当 Raise Event 时,仅仅只是把 EventArgs Push 到消息队列后就立即返回,不管后续执行结果。 优点:
缺点:
|
DingpingZhang
added a commit
that referenced
this issue
Nov 21, 2021
DingpingZhang
added a commit
that referenced
this issue
Oct 4, 2022
DingpingZhang
added a commit
that referenced
this issue
Oct 4, 2022
DingpingZhang
added a commit
that referenced
this issue
Oct 4, 2022
DingpingZhang
added a commit
that referenced
this issue
Oct 4, 2022
DingpingZhang
added a commit
that referenced
this issue
Oct 4, 2022
DingpingZhang
added a commit
that referenced
this issue
Oct 4, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
背景:
当前的合同接口仅支持方法成员,按目前设定:Server 在同一个域内应该是唯一的,不允许启动第二个 Server 实例,以避免 Client 无法区分服务的提供者;而 Client 方则允许创建多个实例与唯一的 Server 交互,但交互方式仅为:Client 调用 Server,Server 在本次调用中应答一次 Client,是单对单的交互方式,还缺乏一种单对多的通知方式,即多播事件。
方案:
使当前的合同接口可以定义事件,事件的行为应当是:Server 发布事件后,所有 Client 实例(可能有多个)中订阅了该事件的 Handler 都应该被触发。Client 之间若想交互,仅可以通过调用 Server 方法以触发某个 Server Event 的方式进行。
实现:
该 Feature 本质上是:
考虑到以下问题,我们并不能简单地将目前的
SenderBase
和ReceiverBase
进行互换:Tcp 中,同一台机器中的同一个端口仅允许被一个实例监听,如果 Client 侧也创建ReceiverBase
,那么端口号将不方便选取,选取后也还需要通知 Server 侧,实现起来比较麻烦;NamedPipe 虽然允许创建多个同名 Pipe,但多个进程中包含的同名 ServerStream 也会导致 Client 无法区分正确的连接目标。所以,应当借助 Tcp 和 NamedPipe 的全双工能力实现反向的通知。具体的:
The text was updated successfully, but these errors were encountered: