Interface IRemoteServiceBroker
- Namespace
- Microsoft.ServiceHub.Framework
- Assembly
- Microsoft.ServiceHub.Framework.dll
Describes a remotable service broker.
[JsonRpcContract]
[GenerateShape(IncludeMethods = MethodShapeFlags.PublicInstance)]
[TypeShapeProvider(typeof(IRemoteServiceBroker.__LocalTypeShapeProvider__))]
[JsonRpcProxyMapping(typeof(Microsoft_ServiceHub_Framework_IRemoteServiceBroker_Proxy))]
public interface IRemoteServiceBroker
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.
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.
HandshakeAsync(ServiceBrokerClientMetadata, CancellationToken)
Introduces the client to the server to detail the client's capabilities.
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.
Task<RemoteServiceConnectionInfo> RequestServiceChannelAsync(ServiceMoniker serviceMoniker, ServiceActivationOptions options = default, CancellationToken cancellationToken = default)
Parameters
serviceMonikerServiceMonikerThe moniker for the service.
optionsServiceActivationOptionsAdditional options that alter how the service may be activated or provide additional data to the service constructor.
cancellationTokenCancellationTokenA 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.
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.