quarkusio / quarkus

Quarkus: Supersonic Subatomic Java.
https://quarkus.io
Apache License 2.0
13.75k stars 2.67k forks source link

Add support for user defined initialization tasks #32123

Open iocanel opened 1 year ago

iocanel commented 1 year ago

Description

At the moment we support intialization tasks for the following services:

It makes sense to expand coverage to other extension too. For example:

However, internalization is not always as simple as providing an json, yaml, sql file etc. Initialization logic often needs to be expressed programmatically. So, we should be able to allow users write code that consume a client to the target service and performs the initialization. Those tasks should be treated in a way similar to how we currently treat Flyway / Liquibase (including the kubernetes bits).

Additionally, it would be great if we had:

Implementation ideas

We could have an annotation e.g. @Initialization that could be added to a method that expresses the initialization logic. The method may accept arguments that correspond to the clients needed for the initialization.

At runtime we could call these methods in the initialization phase.

iocanel commented 1 year ago

@kdubb: I created this issue following the discussion we had earlier today.