Class JdbcAgentRegistry
java.lang.Object
dev.agenor.adapters.persistence.directory.JdbcAgentRegistry
- All Implemented Interfaces:
AgentRegistry
JDBC implementation of
AgentRegistry.
register(dev.agenor.core.AgentDescriptor) uses upsert semantics (insert-then-update on PK conflict) to support
agent restarts and node failover without requiring callers to distinguish first registration
from re-registration. See ADR-023 for the singleton-per-agent-id contract.
- Since:
- 0.22.0
-
Constructor Summary
ConstructorsConstructorDescriptionJdbcAgentRegistry(JdbcHelper helper) JdbcAgentRegistry(JdbcHelper helper, AgenorTelemetry telemetry) -
Method Summary
Modifier and TypeMethodDescriptionregister(AgentDescriptor descriptor) Registers or updates an agent in the directory.unregister(String agentId) Removes an agent from the directory.updateStatus(String agentId, AgentStatus status) Updates the status of a registered agent.
-
Constructor Details
-
JdbcAgentRegistry
-
JdbcAgentRegistry
- Parameters:
helper- JDBC helper; must not be nulltelemetry- telemetry for registry spans; null treated as noop
-
-
Method Details
-
register
Registers or updates an agent in the directory.On first registration inserts a new row. On re-registration (same
agent_id, e.g. after a restart) updates all mutable fields exceptregistered_at.- Specified by:
registerin interfaceAgentRegistry- Parameters:
descriptor- the agent descriptor, must not be null- Returns:
- a future that completes when registration succeeds
-
unregister
Description copied from interface:AgentRegistryRemoves an agent from the directory.If the agent is not registered the call is a no-op.
- Specified by:
unregisterin interfaceAgentRegistry- Parameters:
agentId- the unique agent identifier, must not be null- Returns:
- a future that completes when unregistration succeeds
-
updateStatus
Description copied from interface:AgentRegistryUpdates the status of a registered agent.Implementations should also update the agent's
lastSeentimestamp. If the agent is not registered the behaviour is implementation-defined (log-and-ignore is recommended for leniency).- Specified by:
updateStatusin interfaceAgentRegistry- Parameters:
agentId- the unique agent identifier, must not be nullstatus- the new status, must not be null- Returns:
- a future that completes when the update succeeds
-