Table of Contents

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

serviceBroker IServiceBroker

The 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

Task

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

TraceSource

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

serviceRequestId Guid

The 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

disposing bool

true if this object is being disposed; false if it is being finalized.

HandshakeAsync(ServiceBrokerClientMetadata, CancellationToken)

Introduces the client to the server to detail the client's capabilities.

public Task HandshakeAsync(ServiceBrokerClientMetadata clientMetadata, CancellationToken cancellationToken = default)

Parameters

clientMetadata ServiceBrokerClientMetadata

The environment, capabilities and attributes of a client of the IRemoteServiceBroker.

cancellationToken CancellationToken

A 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

serviceMoniker ServiceMoniker

The moniker for the service.

serviceActivationOptions ServiceActivationOptions
cancellationToken CancellationToken

A 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

EventHandler<BrokeredServicesChangedEventArgs>

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.