Class ApicurioRegistryClient

java.lang.Object
ai.pipestream.registration.repository.ApicurioRegistryClient

@ApplicationScoped public class ApicurioRegistryClient extends Object
Client for interacting with Apicurio Registry v3. This is the secondary storage for schemas (primary is PostgreSQL).

The Apicurio v3 SDK calls are synchronous/blocking. Callers invoke these methods from virtual threads, so the blocking I/O never pins the Vert.x event loop.

  • Constructor Details

    • ApicurioRegistryClient

      public ApicurioRegistryClient()
      Creates a new client bean. The Apicurio RegistryClient is built lazily in init() once CDI has injected the configured registry URL and Vert.x instance.
  • Method Details

    • createOrUpdateSchema

      public ApicurioRegistryClient.SchemaRegistrationResponse createOrUpdateSchema(String serviceName, String version, String jsonSchema)
      Create or update a schema in Apicurio Registry, deriving the artifact ID from the service name.
      Parameters:
      serviceName - the service name used to build the artifact ID
      version - the schema version to register
      jsonSchema - the JSON schema content to store
      Returns:
      the registration response describing the stored artifact and version
    • createOrUpdateSchemaWithArtifactBase

      public ApicurioRegistryClient.SchemaRegistrationResponse createOrUpdateSchemaWithArtifactBase(String artifactBase, String version, String jsonSchema)
      Create or update a schema with a custom artifact base name. The artifact ID will be built from the base name and version.
      Parameters:
      artifactBase - the base name used to build the artifact ID
      version - the schema version to register
      jsonSchema - the JSON schema content to store
      Returns:
      the registration response describing the stored artifact and version
    • createOrUpdateSchemaWithArtifactId

      public ApicurioRegistryClient.SchemaRegistrationResponse createOrUpdateSchemaWithArtifactId(String artifactId, String version, String jsonSchema)
      Create or update a schema with a pre-built artifact ID. The artifactId should already include the version suffix (use versionedArtifactId to build it).
      Parameters:
      artifactId - the pre-built artifact ID to register under
      version - the schema version to register
      jsonSchema - the JSON schema content to store
      Returns:
      the registration response; when the version already exists, a response reusing the existing registration with a null global ID is returned
    • getSchemaByArtifactId

      public String getSchemaByArtifactId(String artifactId, String version)
      Get schema by raw artifact ID.
      Parameters:
      artifactId - the artifact ID to read
      version - the version expression to fetch; when null or empty the latest version is returned
      Returns:
      the schema content as a string
    • getArtifactContentFromGroup

      public ApicurioRegistryClient.ArtifactContent getArtifactContentFromGroup(String groupId, String artifactId, String version)
      Fetch any artifact's raw content from a specific group. Used by GetSchemaArtifact for protobuf descriptor artifacts, which live outside DEFAULT_GROUP (the proto pipeline publishes them under the descriptor group, conventionally "default").
      Parameters:
      groupId - the registry group to read from
      artifactId - the artifact ID to read
      version - the version expression to fetch; when null or empty the latest branch is used
      Returns:
      the content, or null when the artifact doesn't exist there
    • getSchema

      public String getSchema(String serviceName, String version)
      Get schema by artifact ID (legacy naming, uses versionedArtifactId internally).
      Parameters:
      serviceName - the service name used to derive the artifact ID
      version - the version expression to fetch; when null or empty the latest version is returned
      Returns:
      the schema content as a string
    • isHealthy

      public boolean isHealthy()
      Check if Apicurio is healthy.
      Returns:
      true if the registry system-info endpoint responds, false otherwise
    • listArtifacts

      public List<io.apicurio.registry.rest.client.models.SearchedArtifact> listArtifacts()
      List all artifacts in the group (for reconciliation).
      Returns:
      the artifacts found in the default group (up to the search limit)
    • deleteArtifact

      public boolean deleteArtifact(String serviceName)
      Delete an artifact (for cleanup).
      Parameters:
      serviceName - the service name whose -config artifact should be deleted
      Returns:
      true if the delete succeeded, false if it failed
    • getArtifactMetadata

      public io.apicurio.registry.rest.client.models.ArtifactMetaData getArtifactMetadata(String serviceName)
      Get artifact metadata. Never returns null - throws ApicurioRegistryException if metadata cannot be retrieved.
      Parameters:
      serviceName - the service name whose -config artifact metadata is requested
      Returns:
      the artifact metadata