Struct LocatorProxy
Implements ILocator by making invocations on a remote IceRPC service. This remote service must implement Slice interface Ice::Locator.
[SliceTypeId("::Ice::Locator")]
public readonly record struct LocatorProxy : ILocator, IProxy, IEquatable<LocatorProxy>
- Implements
- Inherited Members
- Extension Methods
Remarks
The Slice compiler generated this record struct from the Slice interface Ice::Locator.
Constructors
LocatorProxy()
Constructs a proxy with an icerpc service address with path DefaultServicePath.
public LocatorProxy()
LocatorProxy(IInvoker, ServiceAddress?, SliceEncodeOptions?)
Constructs a proxy from an invoker, a service address and encode options.
public LocatorProxy(IInvoker invoker, ServiceAddress? serviceAddress = null, SliceEncodeOptions? encodeOptions = null)
Parameters
invokerIInvokerThe invocation pipeline of the proxy.
serviceAddressServiceAddressThe service address. null is equivalent to an icerpc service address with path DefaultServicePath.
encodeOptionsSliceEncodeOptionsThe encode options, used to customize the encoding of request payloads.
LocatorProxy(IInvoker, Uri, SliceEncodeOptions?)
Constructs a proxy from an invoker, a service address URI and encode options.
public LocatorProxy(IInvoker invoker, Uri serviceAddressUri, SliceEncodeOptions? encodeOptions = null)
Parameters
invokerIInvokerThe invocation pipeline of the proxy.
serviceAddressUriUriA URI that represents a service address.
encodeOptionsSliceEncodeOptionsThe encode options, used to customize the encoding of request payloads.
Fields
DefaultServicePath
Represents the default path for IceRPC services that implement Slice interface
Ice::Locator.
public const string DefaultServicePath = "/Ice.Locator"
Field Value
Properties
EncodeOptions
Gets or initializes the encode options, used to customize the encoding of payloads created from this proxy.
public SliceEncodeOptions? EncodeOptions { get; init; }
Property Value
Invoker
Gets or initializes the invocation pipeline of this proxy.
public required IInvoker Invoker { get; init; }
Property Value
ServiceAddress
Gets or initializes the address of the remote service.
public ServiceAddress ServiceAddress { get; init; }
Property Value
Methods
FindAdapterByIdAsync(string, IFeatureCollection?, CancellationToken)
Finds an object adapter by adapter ID and returns a dummy service address with the object adapter's server address(es).
public Task<ServiceAddress?> FindAdapterByIdAsync(string id, IFeatureCollection? features = null, CancellationToken cancellationToken = default)
Parameters
idstringThe adapter ID.
featuresIFeatureCollectionThe invocation features.
cancellationTokenCancellationTokenA cancellation token that receives the cancellation requests.
Returns
- Task<ServiceAddress>
A dummy service address with the adapter's server address(es), or null if an object adapter with adapter ID
idwas not found.
Exceptions
- AdapterNotFoundException
Thrown if an object adapter with this adapter ID was not found. The caller should treat this exception like a null return value.
FindObjectByIdAsync(string, IFeatureCollection?, CancellationToken)
Finds a service by identity (path) and returns a dummy service address with the server address(es) that can be used to reach this service. This dummy service address can also carry no server address and require further resolution using FindAdapterByIdAsync(string, IFeatureCollection?, CancellationToken).
public Task<ServiceAddress?> FindObjectByIdAsync(string id, IFeatureCollection? features = null, CancellationToken cancellationToken = default)
Parameters
idstringThe identity represented as a path.
featuresIFeatureCollectionThe invocation features.
cancellationTokenCancellationTokenA cancellation token that receives the cancellation requests.
Returns
- Task<ServiceAddress>
A dummy service address, or null if a service with the requested identity (path) was not found.
Exceptions
- ObjectNotFoundException
Thrown if a service with the requested identity (path) was not found. The caller should treat this exception like a null return value.
FromPath(string)
Creates a relative proxy from a path.
public static LocatorProxy FromPath(string path)
Parameters
pathstringThe path.
Returns
- LocatorProxy
The new relative proxy.
GetRegistryAsync(IFeatureCollection?, CancellationToken)
Gets a proxy to the locator registry.
public Task<LocatorRegistryProxy?> GetRegistryAsync(IFeatureCollection? features = null, CancellationToken cancellationToken = default)
Parameters
featuresIFeatureCollectionThe invocation features.
cancellationTokenCancellationTokenA cancellation token that receives the cancellation requests.
Returns
- Task<LocatorRegistryProxy?>
A proxy to the locator registry, or null if this locator has no associated registry.