Table of Contents

Class GatewayService

Namespace
Virtufin.Api.Services
Assembly
Virtufin.Api.dll

Implementation of the gRPC Gateway service. Provides service discovery, method invocation, and event subscription capabilities.

public class GatewayService : Gateway.GatewayBase
Inheritance
Gateway.GatewayBase
GatewayService
Inherited Members

Constructors

GatewayService(GrpcReflectionService, ServicesConfiguration, ILogger<GatewayService>, DaprPublishSubscribeClient, DaprResiliencePipeline)

Creates a new GatewayService instance.

public GatewayService(GrpcReflectionService reflectionService, ServicesConfiguration config, ILogger<GatewayService> logger, DaprPublishSubscribeClient pubsubClient, DaprResiliencePipeline resilience)

Parameters

reflectionService GrpcReflectionService

The gRPC reflection service for method discovery.

config ServicesConfiguration

The services configuration containing registered services.

logger ILogger<GatewayService>

The logger for recording service operations.

pubsubClient DaprPublishSubscribeClient

The Dapr pub/sub client for event streaming.

resilience DaprResiliencePipeline

The Dapr resilience pipeline for wrapping gateway invocations.

Methods

GetMethodSchema(GetMethodSchemaRequest, ServerCallContext)

Gets the schema for a specific method including input/output types and field definitions.

public override Task<GetMethodSchemaResponse> GetMethodSchema(GetMethodSchemaRequest request, ServerCallContext context)

Parameters

request GetMethodSchemaRequest

The get method schema request containing service, method, and schema type.

context ServerCallContext

The server call context.

Returns

Task<GetMethodSchemaResponse>

The method schema including field definitions.

Invoke(InvokeRequest, ServerCallContext)

Invokes a method on a backend service using raw protobuf bytes.

public override Task<InvokeResponse> Invoke(InvokeRequest request, ServerCallContext context)

Parameters

request InvokeRequest

The invoke request containing service name, method name, and request data.

context ServerCallContext

The server call context.

Returns

Task<InvokeResponse>

The invoke response containing success status and response data.

InvokeJson(InvokeJsonRequest, ServerCallContext)

Invokes a method on a backend service using JSON request/response data. This is the recommended method for most use cases.

public override Task<InvokeJsonResponse> InvokeJson(InvokeJsonRequest request, ServerCallContext context)

Parameters

request InvokeJsonRequest

The invoke JSON request containing service name, method name, and JSON request data.

context ServerCallContext

The server call context.

Returns

Task<InvokeJsonResponse>

The invoke JSON response containing success status and JSON response data.

ListMethods(ListMethodsRequest, ServerCallContext)

Lists all methods available for a specific service.

public override Task<ListMethodsResponse> ListMethods(ListMethodsRequest request, ServerCallContext context)

Parameters

request ListMethodsRequest

The list methods request containing the service name.

context ServerCallContext

The server call context.

Returns

Task<ListMethodsResponse>

A list of method descriptors.

ListServices(ListServicesRequest, ServerCallContext)

Lists all services registered with the gateway.

public override Task<ListServicesResponse> ListServices(ListServicesRequest request, ServerCallContext context)

Parameters

request ListServicesRequest

The list services request.

context ServerCallContext

The server call context.

Returns

Task<ListServicesResponse>

A list of service names.

Subscribe(SubscribeRequest, IServerStreamWriter<TopicEventRequest>, ServerCallContext)

Subscribes to events from specified services and topics. Returns a stream of TopicEventRequest messages.

public override Task Subscribe(SubscribeRequest request, IServerStreamWriter<TopicEventRequest> responseStream, ServerCallContext context)

Parameters

request SubscribeRequest

The subscribe request containing service, topic, and event type filters.

responseStream IServerStreamWriter<TopicEventRequest>

The stream writer for sending events to the client.

context ServerCallContext

The server call context.

Returns

Task

A task that completes when the subscription is cancelled.