I don’t have any issues with any of the existing APIs.
I’m new to web services, and I’m still getting up to speed on many concepts (part-time).
The external gateways I’m calling are grouped and have multiple backups in each group/cluster.
My use case:
A support employee will call the service, and depending on the customer being serviced, a different external gateway will be called, each customer is assigned to a specific group/cluster.
For now, I moved the group/cluster configuration in my appsettings file and I have this:
using ExternalApiBase;
using ExternalRestApi;
[assembly: HostingStartup(typeof(InternalApi.ConfigureExternalRestApi))]
namespace InternalApi;
public class ConfigureExternalRestApi : IHostingStartup
{
public void Configure(IWebHostBuilder builder) => builder
.ConfigureServices((context, services) =>
{
var externalClusterConfiguration = new ExternalClusterConfiguration();
context.Configuration.GetSection(nameof(ExternalClusterConfiguration))
.Bind(externalClusterConfiguration);
services.AddSingleton<IExternalRestGatewayClusterList>(new ExternalRestGatewayClusterList(externalClusterConfiguration)
);
})
.ConfigureAppHost(appHost =>
{
foreach (var externalRestGatewayClustered in appHost.Resolve<IExternalRestGatewayClusterList>().ExternalRestGatewayClusters)
{
externalRestGatewayClustered.ExternalRestGateway.Login();
}
});
}
And when a query is received I resolve the gateway list and match to the correct gateway:
public QueryUserResponse Get(QueryUser queryUser)
{
var gateway = ResolveService<IExternalRestGatewayClusterList>();
//match queryUser to gateway
}
I will look into the multitenancy documentation and see how you implemented this.