Class ModuleRepository
java.lang.Object
ai.pipestream.registration.repository.ModuleRepository
Repository for managing service module registrations in PostgreSQL.
This is the primary data store (system of record).
Blocking Hibernate ORM (Panache active-record) over JDBC. Write methods are
@Transactional; reads run without a transaction. Callers invoke these from
virtual threads, so the blocking JDBC work never pins the event loop.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionCount registered services by status.Get service by ID.findCurrentSchemaByServiceName(String serviceName) Resolve the schema of the module's CURRENT registration: the instance with the freshest heartbeat wins.findLatestSchemaByServiceName(String serviceName) findSchemaById(String schemaId) Get schema by ID.Get all schemas needing sync to Apicurio.findSchemaVersionsByServiceName(String serviceName) Get all schema versions for a service name, ordered by version descending.Find stale services (no heartbeat for > 30 seconds).Get all active services.Get all services (for admin dashboard).markUnhealthy(String serviceId) Mark service as unhealthy.registerModule(String serviceName, String host, int port, String version, Map<String, Object> metadata, String jsonSchema) Register a new service module with optional schema.saveSchema(String serviceName, String version, String jsonSchema) Save a configuration schema (dual storage: PostgreSQL + Apicurio).booleanunregisterModule(String serviceId) Unregister a service.updateHeartbeat(String serviceId) Update heartbeat for a service.upsertNamedArtifact(String artifactName, String version, String json) Upsert a NAMED schema artifact (recipe schema, uischema, ...) as a ConfigSchema row keyed by the artifact name — same update-on-change semantics as module config schemas, so SNAPSHOT re-registrations refresh content and mark PENDING for Apicurio re-sync.
-
Constructor Details
-
ModuleRepository
public ModuleRepository()
-
-
Method Details
-
registerModule
-
saveSchema
Save a configuration schema (dual storage: PostgreSQL + Apicurio). -
updateHeartbeat
Update heartbeat for a service. -
markUnhealthy
Mark service as unhealthy. -
unregisterModule
Unregister a service. -
getActiveServices
Get all active services. -
getAllServices
Get all services (for admin dashboard). -
findStaleServices
Find stale services (no heartbeat for > 30 seconds). -
findById
Get service by ID. -
findSchemaById
Get schema by ID. -
upsertNamedArtifact
Upsert a NAMED schema artifact (recipe schema, uischema, ...) as a ConfigSchema row keyed by the artifact name — same update-on-change semantics as module config schemas, so SNAPSHOT re-registrations refresh content and mark PENDING for Apicurio re-sync. -
findLatestSchemaByServiceName
-
findCurrentSchemaByServiceName
Resolve the schema of the module's CURRENT registration: the instance with the freshest heartbeat wins. "Latest by createdAt" is wrong once historical version rows exist (e.g. a branch-suffixed snapshot version registered after the canonical one shadows it forever). -
findSchemaVersionsByServiceName
Get all schema versions for a service name, ordered by version descending. -
findSchemasNeedingSync
Get all schemas needing sync to Apicurio. -
countServicesByStatus
Count registered services by status.
-