Interface OutboxInstanceRepository
-
- All Implemented Interfaces:
public interface OutboxInstanceRepositoryRepository interface for managing outbox instance records.
Provides operations for instance registration, heartbeat management, and cleanup of stale instances in a distributed outbox processing environment.
- Since:
0.2.0
Roland Beisel
-
-
Method Summary
Modifier and Type Method Description abstract OutboxInstancesave(OutboxInstance instance)Saves an instance to the repository. abstract OutboxInstancefindById(String instanceId)Finds an instance by its ID. abstract List<OutboxInstance>findAll()Finds all instances in the repository. abstract List<OutboxInstance>findByStatus(OutboxInstanceStatus status)Finds instances by their status. abstract List<OutboxInstance>findActiveInstances()Finds all active instances. abstract List<OutboxInstance>findInstancesWithStaleHeartbeat(OffsetDateTime cutoffTime)Finds instances with stale heartbeats (older than cutoff time). abstract BooleanupdateHeartbeat(String instanceId, OffsetDateTime timestamp)Updates the heartbeat timestamp for an instance. abstract BooleanupdateStatus(String instanceId, OutboxInstanceStatus status, OffsetDateTime timestamp)Updates the status of an instance. abstract BooleandeleteById(String instanceId)Deletes an instance by its ID. abstract IntegerdeleteByStatus(OutboxInstanceStatus status)Deletes all instances with the specified status. abstract IntegerdeleteStaleInstances(OffsetDateTime cutoffTime)Deletes instances with stale heartbeats (cleanup operation). abstract Longcount()Counts the total number of instances. abstract LongcountByStatus(OutboxInstanceStatus status)Counts instances by status. -
-
Method Detail
-
save
abstract OutboxInstance save(OutboxInstance instance)
Saves an instance to the repository.
- Parameters:
instance- The instance to save- Returns:
The saved instance
-
findById
abstract OutboxInstance findById(String instanceId)
Finds an instance by its ID.
- Parameters:
instanceId- The instance ID to search for- Returns:
The instance if found, null otherwise
-
findAll
abstract List<OutboxInstance> findAll()
Finds all instances in the repository.
- Returns:
List of all instances ordered by creation time
-
findByStatus
abstract List<OutboxInstance> findByStatus(OutboxInstanceStatus status)
Finds instances by their status.
- Parameters:
status- The status to filter by- Returns:
List of instances with the specified status
-
findActiveInstances
abstract List<OutboxInstance> findActiveInstances()
Finds all active instances.
- Returns:
List of instances with ACTIVE status
-
findInstancesWithStaleHeartbeat
abstract List<OutboxInstance> findInstancesWithStaleHeartbeat(OffsetDateTime cutoffTime)
Finds instances with stale heartbeats (older than cutoff time).
- Parameters:
cutoffTime- The cutoff time for stale heartbeats- Returns:
List of instances with heartbeats older than cutoff time
-
updateHeartbeat
abstract Boolean updateHeartbeat(String instanceId, OffsetDateTime timestamp)
Updates the heartbeat timestamp for an instance.
- Parameters:
instanceId- The instance ID to updatetimestamp- The new heartbeat timestamp- Returns:
true if the update was successful, false if instance not found
-
updateStatus
abstract Boolean updateStatus(String instanceId, OutboxInstanceStatus status, OffsetDateTime timestamp)
Updates the status of an instance.
- Parameters:
instanceId- The instance ID to updatestatus- The new statustimestamp- The timestamp of the status change- Returns:
true if the update was successful, false if instance not found
-
deleteById
abstract Boolean deleteById(String instanceId)
Deletes an instance by its ID.
- Parameters:
instanceId- The instance ID to delete- Returns:
true if the deletion was successful, false if instance not found
-
deleteByStatus
abstract Integer deleteByStatus(OutboxInstanceStatus status)
Deletes all instances with the specified status.
- Parameters:
status- The status of instances to delete- Returns:
The number of instances deleted
-
deleteStaleInstances
abstract Integer deleteStaleInstances(OffsetDateTime cutoffTime)
Deletes instances with stale heartbeats (cleanup operation).
- Parameters:
cutoffTime- The cutoff time for stale heartbeats- Returns:
The number of instances deleted
-
count
abstract Long count()
Counts the total number of instances.
- Returns:
The total count of instances
-
countByStatus
abstract Long countByStatus(OutboxInstanceStatus status)
Counts instances by status.
- Parameters:
status- The status to count- Returns:
The count of instances with the specified status
-
-
-
-