In my opinion, Orleans under appreciated framework out there. It is by far one of the best framework came out of MS. I knew of Actor models from Erlang and Scala and what it gives and finally to see it in MS was amazing.
Here are the reasons why I like Orleans or more to do with Actor implementations
- As a developer, it is easy to write a single threaded model program. In Orleans, all the code we write will be single threaded program.
- Concurrency is very difficult and Orleans hides those details from development.
- Each grain holds its state and handles reading and writing to the back end store. I thought it is pretty cool. This kind of eliminate the data layer/ORM layer from our development mindset.
There are more reasons for why would one like Orleans. But I want to stop at the third point and explain a problem I ran into and how Orleans team helped me fix it.
I was following an example to learn data persistence. Most of the document on the web are all kind of old and if you were to get the latest version from the Orleans (as of writing it is 1.2.0) you get latest version and they did change the template model for how one would use data persistence. Earlier you would need a configuration file to let Silo know how to build the persistence. From 1.2.0, it is done through program. Based on what I see there is a method to load from configuration but I did not try it.
So far anyone following example, everything is same except couple of things, starting 1.2.0. They are
- Now you should see a new file in the project called orleanshostwrapper.cs
- This code loads Silo with proper configuration.
- By default, it sets the data provider as “MemoryStore”.
- If you want to change it, you can change it by changing the default parameters of “config.AddMemoryStorageProvider();” method call.
- In the old model, the state objects were defined as interface, now change that to standard class. If you get an error that undefined variable, make sure the field in the class is ‘Public‘.
I was stuck on this issue for a day or two till I got great help from Sergey. Thanks a lot for the great help.