Monq.Core.MicroserviceAddressing
0.2.0-rev-42358101022
See the version list below for details.
dotnet add package Monq.Core.MicroserviceAddressing --version 0.2.0-rev-42358101022
NuGet\Install-Package Monq.Core.MicroserviceAddressing -Version 0.2.0-rev-42358101022
<PackageReference Include="Monq.Core.MicroserviceAddressing" Version="0.2.0-rev-42358101022" />
<PackageVersion Include="Monq.Core.MicroserviceAddressing" Version="0.2.0-rev-42358101022" />
<PackageReference Include="Monq.Core.MicroserviceAddressing" />
paket add Monq.Core.MicroserviceAddressing --version 0.2.0-rev-42358101022
#r "nuget: Monq.Core.MicroserviceAddressing, 0.2.0-rev-42358101022"
#:package Monq.Core.MicroserviceAddressing@0.2.0-rev-42358101022
#addin nuget:?package=Monq.Core.MicroserviceAddressing&version=0.2.0-rev-42358101022&prerelease
#tool nuget:?package=Monq.Core.MicroserviceAddressing&version=0.2.0-rev-42358101022&prerelease
Monq.Core.MicroserviceAddressing
Monq.Core.MicroserviceAddressing provides shared address resolution policies for
MONQ microservices. It creates logical addresses and indicates whether a client must
connect directly or enable client-side service discovery. DNS lookup, HTTP endpoint
selection, and gRPC balancing remain the responsibility of the corresponding client
libraries.
Built-in conventions
| Strategy | HTTP | gRPC |
|---|---|---|
| ClusterIP | http://{application}.{namespace}.svc.cluster.local:80 |
http://{application}.{namespace}.svc.cluster.local:5006 |
| Service Discovery | http://{application}-http.{namespace}.svc.cluster.local:5005 |
dns:///{application}-grpc.{namespace}.svc.cluster.local:5006 |
| Fixed | The supplied absolute URI | The supplied absolute URI |
The namespace is derived from IHostEnvironment.EnvironmentName and normalized to
lowercase. Pass a port to override a strategy default.
Registration
The built-in fallback is Kubernetes ClusterIP:
builder.Services.AddMicroserviceAddressing();
HTTP and gRPC can use different policies:
builder.Services
.UseHttpMicroserviceAddressResolver(
new KubernetesClusterIpAddressResolver())
.UseGrpcMicroserviceAddressResolver(
new KubernetesServiceDiscoveryAddressResolver());
Use one common resolver when a library should provide protocol-specific defaults that an application can replace with a single common override:
builder.Services.UseMicroserviceAddressResolver(
new ProtocolMicroserviceAddressResolver(
httpResolver: new KubernetesClusterIpAddressResolver(),
grpcResolver: new KubernetesServiceDiscoveryAddressResolver()));
A library that provides a fallback policy can call TryUseMicroserviceAddressResolver
instead: it selects the default resolver only when none was selected before, so an
earlier application selection is preserved.
Registrations are observed by the address provider when a client resolves an address,
so the last registration for a scope always wins. In console and worker applications
that build the host with a fluent chain, register resolvers inside ConfigureServices
to observe the final host configuration and environment:
Host.CreateDefaultBuilder(args)
.ConfigureServices((context, services) => services.UseMicroserviceAddressResolver(
new ProductAddressResolver(context.Configuration)));
Resolve an address from another library or application component:
public sealed class EndpointConsumer(IMicroserviceAddressProvider addresses)
{
public Uri Resolve(string applicationName, int port) =>
addresses.Resolve(
applicationName,
MicroserviceProtocol.Http,
port).Address;
}
Resolver precedence is:
- Resolver supplied for a particular client.
- HTTP or gRPC resolver.
- Default resolver.
- Built-in Kubernetes ClusterIP resolver.
Client registration code that must know the endpoint resolution mode before the service provider is built can peek at it from the service collection:
EndpointResolutionMode? mode = builder.Services.TryPeekEndpointResolutionMode(
applicationName,
MicroserviceProtocol.Http);
The peek applies the same precedence as the provider. Configuration and environment
are taken from the registered descriptors, and the result is null when either is
missing or when the selected resolver fails. Because peeking invokes the resolver in
addition to the runtime resolution, resolvers must be side-effect free and must not
resolve application services to compute the mode.
Custom policy
Implement IMicroserviceAddressResolver and replace only the required scope:
public sealed class ProductAddressResolver : IMicroserviceAddressResolver
{
public ResolvedMicroserviceAddress Resolve(MicroserviceAddressContext context)
{
var address = context.Environment.IsDevelopment()
? new Uri(context.Configuration["BaseUri"]!)
: new Uri(
$"http://{context.TargetApplicationName}.custom.svc.cluster.local:{context.PortOverride ?? 80}");
return new(address);
}
}
builder.Services.UseHttpMicroserviceAddressResolver(
new ProductAddressResolver());
The selected resolver instance is shared by client registration and the runtime
IMicroserviceAddressProvider.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | 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 is compatible. 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
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.0)
- Microsoft.Extensions.Hosting.Abstractions (>= 10.0.0)
-
net8.0
-
net9.0
NuGet packages (4)
Showing the top 4 NuGet packages that depend on Monq.Core.MicroserviceAddressing:
| Package | Downloads |
|---|---|
|
Monq.Core.BasicDotNetMicroservice
NetCore Microservice extensions library that brings simplicity to configure asp.net and console programs as microservices. |
|
|
Monq.Core.HttpClientExtensions
The HTTP client extensions for the microservice communication with openid support. |
|
|
Monq.Core.Authorization
Middleware-библиотека для поддержки авторизации запросов через сервис пользовательских прав MONQ. |
|
|
Monq.Core.GrpcClientExtensions
Shared gRPC client registration on top of Monq.Core.MicroserviceAddressing: name-based addresses, scheme-aware credentials, round-robin balancing and DNS service discovery. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.4.0-rev-42810395704 | 189 | 11/10/2026 |
| 0.3.0-rev-42358150343 | 248 | 11/7/2026 |
| 0.2.0-rev-42358101022 | 97 | 11/7/2026 |
| 0.2.0-rev-42252065267 | 151 | 11/6/2026 |
| 0.1.0 | 198 | 10/29/2026 |
| 0.1.0-rev-40878119964 | 106 | 10/29/2026 |