Sponsor: Do you build complex software systems? See how NServiceBus makes it easier to design, build, and manage software systems that use message queues to achieve loose coupling. Get started for free.
With the release of Orleans 3.0 comes the ability to co-host with ASP.NET Core (or any other framework that uses the generic host builder).
What this means is you can run Orleans and ASP.NET Core in the same process.
The advantage to this is both services will share the same service provider, logging, etc that is configured with the host builder.
Orleans and ASP.NET Core
The extension method UseOrleans() is available now on the IHostBuilder. Just like you would configure the ASP.NET Core via ConfigureWebHostDefaults, you can configure the Orleans silo.
One of the nice benefits here is that because both services share service registrations, an ASP.NET Core MVC controller can have the IClusterClient injected into it.
Also since logging is configured it is shared between both ASP.NET Core and Orleans. When I run my demo application, you can see both services in my console logs.
Another benefit of co-hosting Orleans and ASP.NET Core is you can provide a frontend via ASP.NET Core to expose status of your Orleans silo. I’ve written about the ASP.NET Core Health Checks over on the Telerik Blog.
If you’re running in something Docker, AWS ECS or Kubernetes, this would provide you information to determine the health/liveness of your services
If you want more info on the 3.0 release, check out the Announcement for all the details.
Also, check out other related posts:
- Part 1 – Practical Orleans
- Part 2 – Grains and Silos
- Part 3 – Smart Cache Pattern
Part 4 – Event Sourced Grain
- Part 5 – EventStore for Grain Persistence