Class QuarkusGrpcHandler

All Implemented Interfaces:
io.grpc.BindableService, A2AServiceGrpc.AsyncService

public class QuarkusGrpcHandler extends GrpcHandler
Quarkus gRPC service implementation for the A2A protocol.

This class provides a production-ready gRPC service built on Quarkus gRPC, implementing the A2A protocol with CDI integration, authentication, and interceptor support for metadata extraction.

CDI Integration

This class is a Quarkus gRPC service (@GrpcService) that automatically:

Security

The service is protected with @Authenticated annotation, requiring authentication for all gRPC method calls. Configure authentication in application.properties:

 quarkus.security.users.embedded.enabled=true
 quarkus.security.users.embedded.plain-text=true
 quarkus.security.users.embedded.users.alice=password
 

Interceptor Registration

The @RegisterInterceptor annotation automatically registers A2AExtensionsInterceptor to capture A2A protocol headers and metadata before service methods are invoked.

Extension Points

To customize context creation, provide a CDI bean implementing CallContextFactory:


 @ApplicationScoped
 public class CustomCallContextFactory implements CallContextFactory {
     @Override
     public <V> ServerCallContext create(StreamObserver<V> responseObserver) {
         // Custom context creation logic
     }
 }
 
See Also:
  • Constructor Details

    • QuarkusGrpcHandler

      @Inject public QuarkusGrpcHandler(AgentCard agentCard, jakarta.enterprise.inject.Instance<AgentCard> extendedAgentCard, RequestHandler requestHandler, jakarta.enterprise.inject.Instance<CallContextFactory> callContextFactoryInstance, Executor executor)
      Constructs a new QuarkusGrpcHandler with CDI-injected dependencies.

      This constructor is invoked by CDI to create the gRPC service bean, injecting all required and optional dependencies.

      Required Dependencies:

      • agentCard - Public agent card defining capabilities
      • requestHandler - Request handler for protocol operations
      • executor - Executor for async operations

      Optional Dependencies:

      • extendedAgentCard - Extended agent card (can be unresolvable)
      • callContextFactoryInstance - Custom context factory (can be unsatisfied)
      Parameters:
      agentCard - the public agent card (qualified with @PublicAgentCard)
      extendedAgentCard - the extended agent card instance (qualified with @ExtendedAgentCard)
      requestHandler - the request handler for protocol operations
      callContextFactoryInstance - the call context factory instance (optional)
      executor - the executor for async operations (qualified with @Internal)
  • Method Details

    • getRequestHandler

      protected RequestHandler getRequestHandler()
      Description copied from class: GrpcHandler
      Returns the request handler instance for processing A2A protocol requests.
      Specified by:
      getRequestHandler in class GrpcHandler
      Returns:
      the request handler
    • getAgentCard

      protected AgentCard getAgentCard()
      Description copied from class: GrpcHandler
      Returns the public agent card defining the agent's capabilities and metadata.
      Specified by:
      getAgentCard in class GrpcHandler
      Returns:
      the agent card
    • getExtendedAgentCard

      protected AgentCard getExtendedAgentCard()
      Description copied from class: GrpcHandler
      Returns the extended agent card with additional capabilities, or null if not configured.
      Specified by:
      getExtendedAgentCard in class GrpcHandler
      Returns:
      the extended agent card, or null if not available
    • getCallContextFactory

      protected CallContextFactory getCallContextFactory()
      Description copied from class: GrpcHandler
      Returns the custom call context factory, or null to use default context creation.
      Specified by:
      getCallContextFactory in class GrpcHandler
      Returns:
      the call context factory, or null for default behavior
    • getExecutor

      protected Executor getExecutor()
      Description copied from class: GrpcHandler
      Returns the executor for running async operations (streaming subscriptions, etc.).
      Specified by:
      getExecutor in class GrpcHandler
      Returns:
      the executor