Member-only story

Microsoft Orleans — Observers

Russell Hammett Jr. (Kritner)
6 min readJan 16, 2019

--

Photo by Freddy Marschall on Unsplash

As we continue exploring Microsoft Orleans — the virtual actor model framework — we happen upon Observers. Observers can be used to “observe” events, in the form of notifications, as an example.

Orleans observers are build by creating an interface that implements the Orleans’ namespaces’ IGrainObserver interface. Observer methods must have a void return type, and can be invoked via a grain when “something” happens, in the form of a method call.

The Orleans Observers documentation can be found:

What we’ll need

There are a few steps to setting up an observer and a grain that can manage observers:

  • New interface that implements IGrainObserver, and a class the implements the new interface.
  • A new grain interface and grain that provide a subscribe, unsubscribe, and notify like method.
  • A class to manage registered observers.
  • A method of using the above observer.

New interface implementing IGrainObserver

--

--

Russell Hammett Jr. (Kritner)
Russell Hammett Jr. (Kritner)

Written by Russell Hammett Jr. (Kritner)

Just a boring Application Developer/Dad. I enjoy gaming, learning new technologies, reading, and potentially other stuff. That’s about it.

No responses yet