Class IpcRelayServiceBroker
- Namespace
- Microsoft.ServiceHub.Framework
- Assembly
- Microsoft.ServiceHub.Framework.dll
An IRemoteServiceBroker which proffers all services from another IServiceBroker over named pipes on Windows or Unix domain sockets on other operating systems.
public class IpcRelayServiceBroker : IRemoteServiceBroker, IDisposable
- Inheritance
-
IpcRelayServiceBroker
- Implements
- Inherited Members
Constructors
IpcRelayServiceBroker(IServiceBroker)
Initializes a new instance of the IpcRelayServiceBroker class.
public IpcRelayServiceBroker(IServiceBroker serviceBroker)
Parameters
serviceBrokerIServiceBrokerThe service broker whose services are to be exposed.
Properties
Completion
Gets a Task that completes when this instance is disposed of.
public Task Completion { get; }
Property Value
Remarks
This event will occur when the client disconnects from the relay, if the RPC library is configured to dispose target objects at that time.
TraceSource
Gets the logging mechanism.
public TraceSource? TraceSource { get; init; }
Property Value
Methods
CancelServiceRequestAsync(Guid)
Releases resources allocated as a result of a prior call to RequestServiceChannelAsync(ServiceMoniker, ServiceActivationOptions, CancellationToken) when the client cannot or will not complete the connection to the requested service.
public Task CancelServiceRequestAsync(Guid serviceRequestId)
Parameters
serviceRequestIdGuidThe value of RequestId from the connection instructions that will not be followed.
Returns
- Task
A task representing the request to cancel.
Dispose()
public void Dispose()
Dispose(bool)
Disposes managed and unmanaged resources owned by this instance.
protected virtual void Dispose(bool disposing)
Parameters
HandshakeAsync(ServiceBrokerClientMetadata, CancellationToken)
Introduces the client to the server to detail the client's capabilities.
public Task HandshakeAsync(ServiceBrokerClientMetadata clientMetadata, CancellationToken cancellationToken = default)
Parameters
clientMetadataServiceBrokerClientMetadataThe environment, capabilities and attributes of a client of the IRemoteServiceBroker.
cancellationTokenCancellationTokenA cancellation token.
Returns
- Task
A task representing this async call.
Exceptions
- NotSupportedException
Thrown when this service broker does not support any of the supported service connection kinds that the client offered in SupportedConnections.
RequestServiceChannelAsync(ServiceMoniker, ServiceActivationOptions, CancellationToken)
Gets a pipe to a service.
public Task<RemoteServiceConnectionInfo> RequestServiceChannelAsync(ServiceMoniker serviceMoniker, ServiceActivationOptions serviceActivationOptions, CancellationToken cancellationToken = default)
Parameters
serviceMonikerServiceMonikerThe moniker for the service.
serviceActivationOptionsServiceActivationOptionscancellationTokenCancellationTokenA cancellation token.
Returns
- Task<RemoteServiceConnectionInfo>
Instructions for how the client may connect to the service.
Remarks
Upon successful completion, resources may have already been allocated for the anticipated connection. If the connection will not be made (either because the client lost interest or cannot follow the instructions), the client should call CancelServiceRequestAsync(Guid) with the value of RequestId to release the allocated resources.
Events
AvailabilityChanged
Occurs when a service previously queried for since the last AvailabilityChanged event may have changed availability.
public event EventHandler<BrokeredServicesChangedEventArgs> AvailabilityChanged
Event Type
Remarks
Not all service availability changes result in raising this event. Only those changes that impact services queried for on this IServiceBroker instance will result in an event being raised. Changes already broadcast in a prior event are not included in a subsequent event. The data included in this event may be a superset of the minimum described here.