Interface CallContextFactory


public interface CallContextFactory
Factory interface for creating ServerCallContext from Vert.x routing context.

This interface provides an extension point for customizing how ServerCallContext instances are created in Quarkus REST applications. The default implementation in A2AServerRoutes extracts standard information (user, headers, tenant, protocol version), but applications can provide their own implementation to add custom context data.

Default Behavior

When no CDI bean implementing this interface is provided, A2AServerRoutes creates contexts with:

  • User authentication from Quarkus Security
  • HTTP headers map
  • Tenant ID from URL path
  • A2A protocol version from X-A2A-Version header
  • Required extensions from X-A2A-Extensions header

Custom Implementation Example

@ApplicationScoped
public class CustomCallContextFactory implements CallContextFactory {
    @Override
    public ServerCallContext build(RoutingContext rc) {
        // Extract custom data from routing context
        String orgId = rc.request().getHeader("X-Organization-ID");

        Map<String, Object> state = new HashMap<>();
        state.put("organization", orgId);
        state.put("requestId", UUID.randomUUID().toString());

        return new ServerCallContext(
            extractUser(rc),
            state,
            extractExtensions(rc),
            extractVersion(rc)
        );
    }
}
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    build(io.vertx.ext.web.RoutingContext rc)
    Builds a ServerCallContext from a Vert.x routing context.
  • Method Details

    • build

      ServerCallContext build(io.vertx.ext.web.RoutingContext rc)
      Builds a ServerCallContext from a Vert.x routing context.

      This method is called for each incoming HTTP request to create the context that will be passed to the RequestHandler and eventually to the AgentExecutor.

      Parameters:
      rc - the Vert.x routing context containing request data
      Returns:
      a new ServerCallContext with extracted authentication, headers, and metadata