diff --git a/example/OcelotOrleans.AspNetCore/Program.cs b/example/OcelotOrleans.AspNetCore/Program.cs index 9d6d478..1b744f1 100644 --- a/example/OcelotOrleans.AspNetCore/Program.cs +++ b/example/OcelotOrleans.AspNetCore/Program.cs @@ -7,6 +7,7 @@ using Ocelot.Middleware; using Ocelot.OrleansHttpGateway.Configuration; using Ocelot.OrleansHttpGateway.Requester; +using Ocelot.Provider.Consul; using Orleans.Hosting; using System; using System.IO; diff --git a/example/OcelotOrleans.AspNetCore/wwwroot/OrleansInterface.dll b/example/OcelotOrleans.AspNetCore/wwwroot/OrleansInterface.dll index 951cfae..50fd92e 100644 Binary files a/example/OcelotOrleans.AspNetCore/wwwroot/OrleansInterface.dll and b/example/OcelotOrleans.AspNetCore/wwwroot/OrleansInterface.dll differ diff --git a/src/Ocelot.OrleansHttpGateway/Configuration/OcelotBuilderExtensions.cs b/src/Ocelot.OrleansHttpGateway/Configuration/OcelotBuilderExtensions.cs index c0e771e..aea02b1 100644 --- a/src/Ocelot.OrleansHttpGateway/Configuration/OcelotBuilderExtensions.cs +++ b/src/Ocelot.OrleansHttpGateway/Configuration/OcelotBuilderExtensions.cs @@ -2,16 +2,19 @@ using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection.Extensions; using Newtonsoft.Json; +using Ocelot.Configuration.Repository; using Ocelot.DependencyInjection; using Ocelot.Middleware; using Ocelot.OrleansHttpGateway.Configuration; using Ocelot.OrleansHttpGateway.Infrastructure; using Ocelot.OrleansHttpGateway.Requester; +using Ocelot.ServiceDiscovery; using Orleans; using Orleans.Configuration; using Orleans.Runtime; using System; using System.Linq; +using System.Threading.Tasks; namespace Ocelot.DependencyInjection { @@ -60,6 +63,10 @@ private static IServiceCollection AddOrleansHttpGateway(this IServiceCollection services.TryAddSingleton(); services.TryAddSingleton(); services.TryAddSingleton(); + + //Orleans need to use ServiceName configuration, configure ServiceName must have a service discovery provider, component forgery one + if (services.Where(s => s.ServiceType.Name == typeof(ServiceDiscoveryFinderDelegate).Name).Count() == 0) + services.TryAddSingleton((provider, config, name) => throw new Exception($"Unable to find service discovery provider for type: {config.Type}")); return services; } } diff --git a/src/Ocelot.OrleansHttpGateway/Ocelot.OrleansHttpGateway.csproj b/src/Ocelot.OrleansHttpGateway/Ocelot.OrleansHttpGateway.csproj index 81be210..21bc47b 100644 --- a/src/Ocelot.OrleansHttpGateway/Ocelot.OrleansHttpGateway.csproj +++ b/src/Ocelot.OrleansHttpGateway/Ocelot.OrleansHttpGateway.csproj @@ -23,7 +23,7 @@ - +