Package org.keycloak.events.outbox
Class OutboxCleanupTask
java.lang.Object
org.keycloak.events.outbox.OutboxCleanupTask
- All Implemented Interfaces:
Runnable
Background cleanup task that drains outbox rows owned by a removed
realm or owner (e.g. receiver client). Runs in a single bounded
transaction so the admin's original removal transaction can commit
immediately instead of carrying a six-digit
DELETE on its
back.
Submitted by a feature's lifecycle listener (e.g. SSF's
RealmRemovedEvent / ClientRemovedEvent handler) to
a Keycloak-managed executor. The task itself opens a fresh session
via KeycloakModelUtils.runJobInTransaction(org.keycloak.models.KeycloakSessionFactory, org.keycloak.models.KeycloakSessionTask) so it doesn't
inherit the caller's transaction or session lifecycle.
Crash safety: if the node running this task dies mid-flight, the
remaining rows are orphaned. That's bounded by the
pendingMaxAge backstop on the drainer for queued rows and
by the configured retention windows for terminal rows — orphan rows
eventually get swept either way.
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final Stringprotected final KeycloakSessionFactoryprotected final Stringprotected final OutboxCleanupTask.Scopeprotected final Function<KeycloakSession,OutboxStore> -
Constructor Summary
ConstructorsConstructorDescriptionOutboxCleanupTask(KeycloakSessionFactory factory, Function<KeycloakSession, OutboxStore> storeFactory, String entryKind, OutboxCleanupTask.Scope scope, String key) -
Method Summary
-
Field Details
-
factory
-
storeFactory
-
entryKind
-
scope
-
key
-
-
Constructor Details
-
OutboxCleanupTask
public OutboxCleanupTask(KeycloakSessionFactory factory, Function<KeycloakSession, OutboxStore> storeFactory, String entryKind, OutboxCleanupTask.Scope scope, String key)
-
-
Method Details