Can Reactive Extensions (Rx) be used across process or machine boundaries?

后端 未结 7 1480
名媛妹妹
名媛妹妹 2021-02-08 03:48

Vaguely remember seeing some discussions on this quite a while back but haven\'t heard anything since. So basically are you able to subscribe to an IObservable on a remote machi

7条回答
  •  栀梦
    栀梦 (楼主)
    2021-02-08 04:11

    Yes.

    RX has built in support for using .NET Remoting to cross process boundaries.

    If you install the NuGet package rx-remoting, it will install the assembly System.Reactive.Runtime.Remoting.dll which provides support for cross-process RX messages.

    For demo code from Microsoft, see RX Across Processes. I've just tested the code on this page, and it works nicely. In order to get it to compile, you will need to add the following references:

    • NuGet: Reactive Extensions - Main Library (search for reactive extensions main)
    • NuGet: Reactive Extensions - .NET Remoting Support (search for reactive extensions remoting)
    • System.Runtime.Remoting (add as a normal reference, this assembly ships with .NET)

    The Channel 9 video mentioned by @theburningmonk is also interesting to watch.

    Update

    Unfortuantely, this solution has one large limitation: you can only have one client process listening (all subsequent clients cannot connect). Pushqa solves this problem (see my other answer). Essentially, any library which implements RX on top of a pub/sub signalling bus should do the trick.

提交回复
热议问题