Feast.Extensions.ServiceDiscovery.Yarp.Consul
0.2.0
dotnet add package Feast.Extensions.ServiceDiscovery.Yarp.Consul --version 0.2.0
NuGet\Install-Package Feast.Extensions.ServiceDiscovery.Yarp.Consul -Version 0.2.0
<PackageReference Include="Feast.Extensions.ServiceDiscovery.Yarp.Consul" Version="0.2.0" />
<PackageVersion Include="Feast.Extensions.ServiceDiscovery.Yarp.Consul" Version="0.2.0" />
<PackageReference Include="Feast.Extensions.ServiceDiscovery.Yarp.Consul" />
paket add Feast.Extensions.ServiceDiscovery.Yarp.Consul --version 0.2.0
#r "nuget: Feast.Extensions.ServiceDiscovery.Yarp.Consul, 0.2.0"
#:package Feast.Extensions.ServiceDiscovery.Yarp.Consul@0.2.0
#addin nuget:?package=Feast.Extensions.ServiceDiscovery.Yarp.Consul&version=0.2.0
#tool nuget:?package=Feast.Extensions.ServiceDiscovery.Yarp.Consul&version=0.2.0
Feast.Extensions.ServiceDiscovery.Yarp.Consul
Use
Consulas the destination resolving backend ofYarp
📦️ Dependencies
- Yarp.ReverseProxy >2.1.0
- Consul >1.6.1.1
📕 Usage
in Program.cs
// any chance we can resolve IConsulClient from service provider
builder.Services.Add<IConsulClient>();
// configure Yarp
builder.Services.AddReverseProxy()
.LoadFrom(whatever_it_is)
.AddConsulDestinationResolver(); // add consul as destination resolver
in Yarp configuration whatever_it_is.json like
{
"Routes": {
"My-Service": {
"ClusterId": "NotImportant",
"Match": {
"Path": "{**all}"
}
}
},
"Clusters": {
"NotImportant": {
"Destinations": {
"consul/dc1": {
"Address": "https+http://my-service"
},
"others will still working" : {
"Address" : "..."
}
}
}
}
}
In Destinations field, the name should be formatted like consul/dc{number}
indicates that this destination points to consul
the Host of Address will be filled into the query as service field,
and send request like
http://your-consul/dc1/health/service/my-service
🛠 Customize
If you want to self-resolve naming policy instead of consul/dc like, you can
builder.Services.AddReverseProxy()
.AddConsulDestinationResolver(o =>
{
o.TransformContext = (name, config) =>
{
// your custom strategy, just tell me datacenter and service as well
}
});
Also including query options configuring
builder.Services.AddReverseProxy()
.AddConsulDestinationResolver(o =>
{
o.OptionsFactory = context =>
{
return your options;
}
});
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- Consul (>= 1.6.1.1)
- Yarp.ReverseProxy (>= 2.1.0)
-
net6.0
- Consul (>= 1.6.1.1)
- Yarp.ReverseProxy (>= 2.1.0)
-
net8.0
- Consul (>= 1.6.1.1)
- Yarp.ReverseProxy (>= 2.1.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Add path and query, supports 'consul' default as 'consul/dc1'