Interface IBrokeredServiceContainer
- Namespace
- Nerdbank.JsonRpc.BrokeredServices
- Assembly
- Nerdbank.JsonRpc.dll
Publishes service implementations through a broker.
public interface IBrokeredServiceContainer
- Extension Methods
Methods
GetServiceBroker(ServiceAudience)
Creates a broker view with independent availability tracking.
IServiceBroker GetServiceBroker(ServiceAudience audience = ServiceAudience.Local)
Parameters
audienceServiceAudienceFlags every exposed service must have. None imposes no requirements, but never exposes services with no location audience.
Returns
- IServiceBroker
The broker view.
Remarks
Use Local for an RPC relay, optionally combined with PublicSdk. Process-only services cannot be acquired as pipes.
Proffer<T>(IJsonRpcDescriptor<T>, BrokeredServiceFactory<T>)
Publishes an implementation until its proffer lease is disposed.
IDisposable Proffer<T>(IJsonRpcDescriptor<T> descriptor, BrokeredServiceFactory<T> factory) where T : class
Parameters
descriptorIJsonRpcDescriptor<T>The descriptor for an already registered service.
factoryBrokeredServiceFactory<T>The per-client activation factory.
Returns
- IDisposable
A lease that removes availability without destroying existing clients.
Type Parameters
TThe primary service contract.
Exceptions
- InvalidOperationException
The moniker is not registered or is already proffered.
Register(ServiceRegistration)
Registers a service identity and optional on-demand loader without loading its implementation.
void Register(ServiceRegistration registration)
Parameters
registrationServiceRegistrationThe service metadata.
Remarks
May be called concurrently with acquisitions and other catalog operations. Duplicate registrations are rejected.
Unregister(ServiceMoniker)
Removes a registration and its current proffer without destroying existing activations.
bool Unregister(ServiceMoniker moniker)
Parameters
monikerServiceMonikerThe identity to remove.
Returns
- bool
Whether the service was registered.
Remarks
May be called on a live container. Pending lookups cannot use the removed registration to discover a replacement, and existing activations remain client-owned.