Class GrpcGateway
- Namespace
- Microsoft.AutoGen.RuntimeGateway.Grpc
- Assembly
- Microsoft.AutoGen.RuntimeGateway.Grpc.dll
Represents the gRPC gateway service that handles communication between the agent worker and the cluster.
public sealed class GrpcGateway : BackgroundService, IHostedService, IDisposable, IGateway, IGrainObserver, IAddressable
- Inheritance
-
GrpcGateway
- Implements
- Inherited Members
Constructors
GrpcGateway(IClusterClient, ILogger<GrpcGateway>)
Initializes a new instance of the GrpcGateway class.
public GrpcGateway(IClusterClient clusterClient, ILogger<GrpcGateway> logger)
Parameters
clusterClientIClusterClientThe cluster client.
loggerILogger<GrpcGateway>The logger.
Fields
_controlWorkers
public readonly ConcurrentDictionary<string, GrpcWorkerConnection<ControlMessage>> _controlWorkers
Field Value
_workers
public readonly ConcurrentDictionary<string, GrpcWorkerConnection<Message>> _workers
Field Value
Methods
ExecuteAsync(CancellationToken)
Executes the background service.
protected override Task ExecuteAsync(CancellationToken stoppingToken)
Parameters
stoppingTokenCancellationTokenThe cancellation token.
Returns
- Task
A task that represents the asynchronous operation.
GetSubscriptionsAsync(GetSubscriptionsRequest, CancellationToken)
Gets the subscriptions asynchronously.
public ValueTask<List<Subscription>> GetSubscriptionsAsync(GetSubscriptionsRequest request, CancellationToken cancellationToken = default)
Parameters
requestGetSubscriptionsRequestThe get subscriptions request.
cancellationTokenCancellationTokenThe cancellation token.
Returns
- ValueTask<List<Subscription>>
A task that represents the asynchronous operation. The task result contains the list of subscriptions.
InvokeRequestAsync(RpcRequest, CancellationToken)
Invokes a request asynchronously.
public ValueTask<RpcResponse> InvokeRequestAsync(RpcRequest request, CancellationToken cancellationToken = default)
Parameters
requestRpcRequestThe RPC request.
cancellationTokenCancellationTokenThe cancellation token.
Returns
- ValueTask<RpcResponse>
A task that represents the asynchronous operation. The task result contains the RPC response.
RegisterAgentTypeAsync(RegisterAgentTypeRequest, ServerCallContext, CancellationToken)
Registers an agent type asynchronously.
public ValueTask<RegisterAgentTypeResponse> RegisterAgentTypeAsync(RegisterAgentTypeRequest request, ServerCallContext context, CancellationToken cancellationToken = default)
Parameters
requestRegisterAgentTypeRequestThe register agent type request.
contextServerCallContextThe server call context.
cancellationTokenCancellationTokenThe cancellation token.
Returns
- ValueTask<RegisterAgentTypeResponse>
A task that represents the asynchronous operation. The task result contains the register agent type response.
SubscribeAsync(AddSubscriptionRequest, CancellationToken)
Subscribes to a topic asynchronously.
public ValueTask<AddSubscriptionResponse> SubscribeAsync(AddSubscriptionRequest request, CancellationToken cancellationToken = default)
Parameters
requestAddSubscriptionRequestThe add subscription request.
cancellationTokenCancellationTokenThe cancellation token.
Returns
- ValueTask<AddSubscriptionResponse>
A task that represents the asynchronous operation. The task result contains the add subscription response.
UnsubscribeAsync(RemoveSubscriptionRequest, CancellationToken)
Unsubscribes from a topic asynchronously.
public ValueTask<RemoveSubscriptionResponse> UnsubscribeAsync(RemoveSubscriptionRequest request, CancellationToken cancellationToken = default)
Parameters
requestRemoveSubscriptionRequestThe remove subscription request.
cancellationTokenCancellationTokenThe cancellation token.
Returns
- ValueTask<RemoveSubscriptionResponse>
A task that represents the asynchronous operation. The task result contains the remove subscription response.