Class ApicurioRegistryClient
java.lang.Object
ai.pipestream.registration.repository.ApicurioRegistryClient
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.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordRaw content + content-type of an artifact in an ARBITRARY group (e.g.static classResult of registering a schema in Apicurio Registry, capturing the artifact ID, the assigned global ID, and the version that was stored. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncreateOrUpdateSchema(String serviceName, String version, String jsonSchema) Create or update a schema in Apicurio Registry, deriving the artifact ID from the service name.createOrUpdateSchemaWithArtifactBase(String artifactBase, String version, String jsonSchema) Create or update a schema with a custom artifact base name.createOrUpdateSchemaWithArtifactId(String artifactId, String version, String jsonSchema) Create or update a schema with a pre-built artifact ID.booleandeleteArtifact(String serviceName) Delete an artifact (for cleanup).getArtifactContentFromGroup(String groupId, String artifactId, String version) Fetch any artifact's raw content from a specific group.io.apicurio.registry.rest.client.models.ArtifactMetaDatagetArtifactMetadata(String serviceName) Get artifact metadata.Get schema by artifact ID (legacy naming, uses versionedArtifactId internally).getSchemaByArtifactId(String artifactId, String version) Get schema by raw artifact ID.booleanCheck if Apicurio is healthy.List<io.apicurio.registry.rest.client.models.SearchedArtifact> List all artifacts in the group (for reconciliation).
-
Constructor Details
-
ApicurioRegistryClient
public ApicurioRegistryClient()Creates a new client bean. The ApicurioRegistryClientis built lazily ininit()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 IDversion- the schema version to registerjsonSchema- 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 IDversion- the schema version to registerjsonSchema- 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 underversion- the schema version to registerjsonSchema- the JSON schema content to store- Returns:
- the registration response; when the version already exists, a response reusing the
existing registration with a
nullglobal ID is returned
-
getSchemaByArtifactId
-
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 outsideDEFAULT_GROUP(the proto pipeline publishes them under the descriptor group, conventionally "default").- Parameters:
groupId- the registry group to read fromartifactId- the artifact ID to readversion- 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
Get schema by artifact ID (legacy naming, uses versionedArtifactId internally).- Parameters:
serviceName- the service name used to derive the artifact IDversion- 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:
trueif the registry system-info endpoint responds,falseotherwise
-
listArtifacts
List all artifacts in the group (for reconciliation).- Returns:
- the artifacts found in the default group (up to the search limit)
-
deleteArtifact
Delete an artifact (for cleanup).- Parameters:
serviceName- the service name whose-configartifact should be deleted- Returns:
trueif the delete succeeded,falseif 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-configartifact metadata is requested- Returns:
- the artifact metadata
-