Skip to content

Add dedicated lifecycle events to signal Keycloak initialized and shutting down #42670

@thomasdarimont

Description

@thomasdarimont

Description

Add a dedicated provider events to signal that Keycloak is initialized or getting shutdown.

Discussion

No response

Motivation

It is quite common to run some custom logic once Keycloak has fully started. Currently, it's common to use the PostMigrationEvent to solve this. However, this event only implicitly signals that the server is "ready".
In case a user wants to execute logic on the server shutdown there is no reliable way to do this.

For symmetry reasons it would be helpful to have an event to signal a completed server initialization and a server shutdown.

Details

We could define two additional ProviderEvent's like KeycloakInitializedEvent and KeycloakShutdownEvent.
This would allow users to register a ProviderEventListener via the KeycloakSessionFactory/ ProviderEventManager to register custom logic that runs when Keycloak is initialized or is about to get shutdown.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions