This is a simple library which allows Orleans to be hosted on Service Fabric.
- Create a stateless service to host your actors.
- Install the Orleans Service Fabric Silo package:
PM> Install-Package Microsoft.Orleans.ServiceFabric.Silo -Pre
- Alter the
CreateServiceInstanceListeners
method to construct anOrleansCommunicationListener
, like so:
protected override IEnumerable<ServiceInstanceListener> CreateServiceInstanceListeners()
{
var silo =
new ServiceInstanceListener(
parameters =>
new OrleansCommunicationListener(parameters, this.GetClusterConfiguration(), this.ServicePartition));
return new[] { silo };
}
- Install the Orleans Service Fabric Client package:
PM> Install-Package Microsoft.Orleans.ServiceFabric.Client -Pre
Then consume it in the client, initializing Orleans like so:
OrleansFabricClient.Initialize(new Uri("fabric:/CalculatorApp/CalculatorService"), this.GetConfiguration());
Replace fabric:/CalculatorApp/CalculatorService
with the Service Fabric URI of the service created earlier.
- Start the Azure Storage Emulator - it is currently needed for Orleans to discover other nodes.
- Debug
CalculatorApp
from Visual Studio. - Run
TestClient.exe get
from TestClient's output directory. - Run
TestClient.exe add 3.14
from TestClient's output directory.
Hope this helps :) Hit me up on @ReubenBond if you have questions.
Join us! Orleans is a warm, welcoming community & we're on Gitter: