A recorder bridges the build-time and runtime halves of a Quarkus extension. Its runtime-module methods contain application logic, but calls made during a processor build step record the method’s bytecode instead of executing it immediately. section 12.2.2 section 12.6
A recorder participates in extension processing as follows:
- Place the recorder in the runtime module and annotate the class with @Recorder. section 12.2.2 section 12.3.4
- Accept build-time values as method arguments; constructed objects and their creation steps are serialized into the packaged application. section 12.2.2
- Call the recorder from a processor build step, which receives a proxy representing the recorded runtime value. section 12.2.2 section 12.3.5
- Choose STATIC_INIT or RUNTIME_INIT; STATIC_INIT can run during native image construction and improve native startup when the operation permits it. section 12.3.5 section 12.6
Metadata handler recorder
MetadataExtensionRecorder.createHandler(String data) returns a new MetadataHandler(data). The processor computes metadata JSON during the build, passes it to the recorder, and packages the handler-construction steps so the data is inlined rather than recomputed during application startup. section 12.3.4 section 12.3.5
Listing 12.8 The recorder for the Metadata extension
package org.acme.metadata.extension.runtime;
import io.quarkus.runtime.annotations.Recorder;
import io.vertx.core.Handler;
import io.vertx.ext.web.RoutingContext;
@Recorder
public class MetadataExtensionRecorder {
public Handler<RoutingContext> createHandler(String data) {
return new MetadataHandler(data);
}
}
The recorder listing shows the minimal runtime-module class, annotation, method signature, and recorded handler construction. section 12.3.4
