Skip to content

Commit

Permalink
Update to Orleans 2.0 final
Browse files Browse the repository at this point in the history
  • Loading branch information
yevhen committed Mar 31, 2018
1 parent 1b9fe67 commit a1e395d
Show file tree
Hide file tree
Showing 11 changed files with 27 additions and 25 deletions.
8 changes: 4 additions & 4 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@
<PropertyGroup>

<!-- Orleans packages -->
<MicrosoftOrleansClientVersion>2.0.0-rc1</MicrosoftOrleansClientVersion>
<MicrosoftOrleansServerVersion>2.0.0-rc1</MicrosoftOrleansServerVersion>
<MicrosoftOrleansCodeGeneratorVersion>2.0.0-rc1</MicrosoftOrleansCodeGeneratorVersion>
<MicrosoftOrleansRuntimeVersion>2.0.0-rc1</MicrosoftOrleansRuntimeVersion>
<MicrosoftOrleansClientVersion>2.0.0</MicrosoftOrleansClientVersion>
<MicrosoftOrleansServerVersion>2.0.0</MicrosoftOrleansServerVersion>
<MicrosoftOrleansCodeGeneratorVersion>2.0.0</MicrosoftOrleansCodeGeneratorVersion>
<MicrosoftOrleansRuntimeVersion>2.0.0</MicrosoftOrleansRuntimeVersion>

<!-- Testing packages -->
<NUnitVersion>3.9.0</NUnitVersion>
Expand Down
4 changes: 3 additions & 1 deletion Samples/CSharp/Observers/Chat.Client/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
using Orleans;
using Orleans.Hosting;
using Orleans.Runtime;
using Orleans.Configuration;

using Orleankka.Client;

namespace Example
Expand Down Expand Up @@ -60,7 +62,7 @@ static async Task<IClientActorSystem> Connect(int retries = 0, TimeSpan? retryTi
try
{
var client = new ClientBuilder()
.ConfigureCluster(options => options.ClusterId = DemoClusterId)
.Configure<ClusterOptions>(options => options.ClusterId = DemoClusterId)
.UseStaticClustering(options => options.Gateways.Add(new IPEndPoint(LocalhostSiloAddress, LocalhostGatewayPort).ToGatewayUri()))
.ConfigureApplicationParts(x => x
.AddApplicationPart(typeof(Join).Assembly)
Expand Down
2 changes: 1 addition & 1 deletion Samples/CSharp/Observers/Chat.Server/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ static async Task Main(string[] args)
Console.WriteLine("Running demo. Booting cluster might take some time ...\n");

var host = new SiloHostBuilder()
.Configure(options => options.ClusterId = DemoClusterId)
.Configure<ClusterOptions>(options => options.ClusterId = DemoClusterId)
.UseDevelopmentClustering(options => options.PrimarySiloEndpoint = new IPEndPoint(LocalhostSiloAddress, LocalhostSiloPort))
.ConfigureEndpoints(LocalhostSiloAddress, LocalhostSiloPort, LocalhostGatewayPort)
.ConfigureApplicationParts(x => x
Expand Down
6 changes: 3 additions & 3 deletions Samples/CSharp/Shared.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ static class DemoExtensions
static readonly IPAddress LocalhostSiloAddress = IPAddress.Loopback;

static ISiloHostBuilder ConfigureDemoClustering(this ISiloHostBuilder builder) => builder
.Configure(options => options.ClusterId = DemoClusterId)
.Configure<ClusterOptions>(options => options.ClusterId = DemoClusterId)
.UseDevelopmentClustering(options => options.PrimarySiloEndpoint = new IPEndPoint(LocalhostSiloAddress, LocalhostSiloPort))
.ConfigureEndpoints(LocalhostSiloAddress, LocalhostSiloPort, LocalhostGatewayPort);

static IClientBuilder ConfigureDemoClustering(this IClientBuilder builder) => builder
.ConfigureCluster(options => options.ClusterId = DemoClusterId)
.Configure<ClusterOptions>(options => options.ClusterId = DemoClusterId)
.UseStaticClustering(options => options.Gateways.Add(new IPEndPoint(LocalhostSiloAddress, LocalhostGatewayPort).ToGatewayUri()));

public static async Task<ISiloHost> Start(this ISiloHostBuilder builder)
Expand All @@ -41,7 +41,7 @@ public static async Task<ISiloHost> Start(this ISiloHostBuilder builder)
.AddMemoryGrainStorage("PubSubStore")
.AddSimpleMessageStreamProvider("sms")
.ConfigureApplicationParts(x => x.AddApplicationPart(typeof(MemoryGrainStorage).Assembly))
.ConfigureServices(services => services.UseInMemoryReminderService())
.UseInMemoryReminderService()
.Build();

await host.StartAsync();
Expand Down
3 changes: 2 additions & 1 deletion Samples/CSharp/Streams/Chat.Client/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using Orleans;
using Orleans.Hosting;
using Orleans.Runtime;
using Orleans.Configuration;

using Orleankka.Client;

Expand Down Expand Up @@ -72,7 +73,7 @@ static async Task<IClientActorSystem> Connect(int retries = 0, TimeSpan? retryTi
try
{
var client = new ClientBuilder()
.ConfigureCluster(options => options.ClusterId = DemoClusterId)
.Configure<ClusterOptions>(options => options.ClusterId = DemoClusterId)
.UseStaticClustering(options => options.Gateways.Add(new IPEndPoint(LocalhostSiloAddress, LocalhostGatewayPort).ToGatewayUri()))
.AddSimpleMessageStreamProvider("sms")
.ConfigureServices(x => x
Expand Down
2 changes: 1 addition & 1 deletion Samples/CSharp/Streams/Chat.Server/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ static async Task Main(string[] args)
Console.WriteLine("Running demo. Booting cluster might take some time ...\n");

var host = new SiloHostBuilder()
.Configure(options => options.ClusterId = DemoClusterId)
.Configure<ClusterOptions>(options => options.ClusterId = DemoClusterId)
.UseDevelopmentClustering(options => options.PrimarySiloEndpoint = new IPEndPoint(LocalhostSiloAddress, LocalhostSiloPort))
.ConfigureEndpoints(LocalhostSiloAddress, LocalhostSiloPort, LocalhostGatewayPort)
.AddMemoryGrainStorage("PubSubStore")
Expand Down
10 changes: 5 additions & 5 deletions Samples/FSharp/Shared.fs
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ module Shared =
type ISiloHostBuilder with

member sb.ConfigureDemoClustering() =
sb.Configure<ClusterOptions>(fun options -> options.ClusterId <- DemoClusterId) |> ignore
sb.UseDevelopmentClustering(fun (options:DevelopmentMembershipOptions) -> options.PrimarySiloEndpoint <- IPEndPoint(LocalhostSiloAddress, LocalhostSiloPort)) |> ignore
sb.Configure<ClusterOptions>(fun (options:ClusterOptions) -> options.ClusterId <- DemoClusterId) |> ignore
sb.UseDevelopmentClustering(fun (options:DevelopmentClusterMembershipOptions) -> options.PrimarySiloEndpoint <- IPEndPoint(LocalhostSiloAddress, LocalhostSiloPort)) |> ignore
sb.ConfigureEndpoints(LocalhostSiloAddress, LocalhostSiloPort, LocalhostGatewayPort) |> ignore

member sb.AddAssembly(assembly:Assembly) =
Expand All @@ -39,10 +39,10 @@ module Shared =
sb.AddMemoryGrainStorageAsDefault() |> ignore
sb.AddMemoryGrainStorage("PubSubStore") |> ignore
sb.AddSimpleMessageStreamProvider("sms") |> ignore
sb.UseInMemoryReminderService() |> ignore

sb.ConfigureApplicationParts(fun x -> x.AddApplicationPart(typeof<MemoryGrainStorage>.Assembly) |> ignore) |> ignore
sb.ConfigureServices(fun (services:IServiceCollection) -> services.UseInMemoryReminderService() |> ignore) |> ignore


task {
let host = sb.Build()
do! host.StartAsync()
Expand All @@ -52,7 +52,7 @@ module Shared =
type IClientBuilder with

member cb.ConfigureDemoClustering() =
cb.ConfigureCluster(fun (options:ClusterOptions) -> options.ClusterId <- DemoClusterId) |> ignore
cb.Configure<ClusterOptions>(fun (options:ClusterOptions) -> options.ClusterId <- DemoClusterId) |> ignore
cb.UseStaticClustering(fun (options:StaticGatewayListProviderOptions) -> options.Gateways.Add(IPEndPoint(LocalhostSiloAddress, LocalhostGatewayPort).ToGatewayUri())) |> ignore

member cb.AddAssembly(assembly:Assembly) =
Expand Down
3 changes: 1 addition & 2 deletions Samples/FSharp/Streams/Chat.Client/Program.fs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

open System
open System.Net
open System.Diagnostics

open FSharp.Control.Tasks
open Orleankka
Expand Down Expand Up @@ -54,7 +53,7 @@ let main argv =
Console.ReadLine() |> ignore

let cb = new ClientBuilder()
cb.ConfigureCluster(fun (options:ClusterOptions) -> options.ClusterId <- DemoClusterId) |> ignore
cb.Configure<ClusterOptions>(fun (options:ClusterOptions) -> options.ClusterId <- DemoClusterId) |> ignore
cb.UseStaticClustering(fun (options:StaticGatewayListProviderOptions) -> options.Gateways.Add(IPEndPoint(LocalhostSiloAddress, LocalhostGatewayPort).ToGatewayUri())) |> ignore
cb.AddSimpleMessageStreamProvider("sms") |> ignore
cb.ConfigureApplicationParts(fun x -> x.AddApplicationPart(typeof<IChatUser>.Assembly).WithCodeGeneration() |> ignore) |> ignore
Expand Down
6 changes: 3 additions & 3 deletions Samples/FSharp/Streams/Chat.Server/Program.fs
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,16 @@ let main argv =
apm.AddApplicationPart(Assembly.GetExecutingAssembly()).WithCodeGeneration() |> ignore

let sb = SiloHostBuilder()
sb.Configure<ClusterOptions>(fun options -> options.ClusterId <- DemoClusterId) |> ignore
sb.UseDevelopmentClustering(fun (options:DevelopmentMembershipOptions) -> options.PrimarySiloEndpoint <- IPEndPoint(LocalhostSiloAddress, LocalhostSiloPort)) |> ignore
sb.Configure<ClusterOptions>(fun (options:ClusterOptions) -> options.ClusterId <- DemoClusterId) |> ignore
sb.UseDevelopmentClustering(fun (options:DevelopmentClusterMembershipOptions) -> options.PrimarySiloEndpoint <- IPEndPoint(LocalhostSiloAddress, LocalhostSiloPort)) |> ignore
sb.ConfigureEndpoints(LocalhostSiloAddress, LocalhostSiloPort, LocalhostGatewayPort) |> ignore

sb.AddMemoryGrainStorageAsDefault() |> ignore
sb.AddMemoryGrainStorage("PubSubStore") |> ignore
sb.AddSimpleMessageStreamProvider("sms") |> ignore
sb.UseInMemoryReminderService() |> ignore

sb.ConfigureApplicationParts(fun x -> configureAssemblies x) |> ignore
sb.ConfigureServices(fun (services:IServiceCollection) -> services.UseInMemoryReminderService() |> ignore) |> ignore
sb.ConfigureOrleankka() |> ignore

use host = sb.Build()
Expand Down
2 changes: 1 addition & 1 deletion Source/Orleankka.TestKit/MessageSerialization.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public MessageSerialization(bool roundtrip, params Type[] serializers)
return;

var builder = new ClientBuilder()
.ConfigureCluster(x => x.ClusterId = "test")
.Configure<ClusterOptions>(x => x.ClusterId = "test")
.UseStaticClustering(x => x.Gateways.Add(new IPEndPoint(0, 0).ToGatewayUri()))
.ConfigureApplicationParts(apm => apm.AddFromAppDomain());

Expand Down
6 changes: 3 additions & 3 deletions Tests/Orleankka.Tests/Testing/TestActions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,16 @@ public override void BeforeTest(ITest test)
return;

var sb = new SiloHostBuilder()
.Configure(options => options.ClusterId = DemoClusterId)
.Configure<ClusterOptions>(options => options.ClusterId = DemoClusterId)
.UseDevelopmentClustering(options => options.PrimarySiloEndpoint = new IPEndPoint(LocalhostSiloAddress, LocalhostSiloPort))
.ConfigureEndpoints(LocalhostSiloAddress, LocalhostSiloPort, LocalhostGatewayPort)
.AddMemoryGrainStorageAsDefault()
.AddMemoryGrainStorage("PubSubStore")
.AddSimpleMessageStreamProvider("sms")
.UseInMemoryReminderService()
.ConfigureServices(services =>
{
services.Configure<GrainCollectionOptions>(options => options.CollectionAge = TimeSpan.FromMinutes(1));
services.UseInMemoryReminderService();
})
.ConfigureApplicationParts(x => x
.AddApplicationPart(GetType().Assembly)
Expand All @@ -61,7 +61,7 @@ public override void BeforeTest(ITest test)
host.StartAsync().Wait();

var cb = new ClientBuilder()
.ConfigureCluster(options => options.ClusterId = DemoClusterId)
.Configure<ClusterOptions>(options => options.ClusterId = DemoClusterId)
.UseStaticClustering(options => options.Gateways.Add(new IPEndPoint(LocalhostSiloAddress, LocalhostGatewayPort).ToGatewayUri()))
.AddSimpleMessageStreamProvider("sms")
.ConfigureApplicationParts(x => x
Expand Down

0 comments on commit a1e395d

Please sign in to comment.