Search in sources :

Example 1 with CoreVertxBuildItem

use of io.quarkus.vertx.core.deployment.CoreVertxBuildItem in project quarkus by quarkusio.

the class VertxProcessor method build.

@BuildStep
@Record(ExecutionTime.RUNTIME_INIT)
VertxBuildItem build(CoreVertxBuildItem vertx, VertxRecorder recorder, List<EventConsumerBusinessMethodItem> messageConsumerBusinessMethods, BuildProducer<GeneratedClassBuildItem> generatedClass, AnnotationProxyBuildItem annotationProxy, LaunchModeBuildItem launchMode, ShutdownContextBuildItem shutdown, BuildProducer<ServiceStartBuildItem> serviceStart, BuildProducer<ReflectiveClassBuildItem> reflectiveClass, List<MessageCodecBuildItem> codecs, RecorderContext recorderContext) {
    Map<String, ConsumeEvent> messageConsumerConfigurations = new HashMap<>();
    ClassOutput classOutput = new GeneratedClassGizmoAdaptor(generatedClass, true);
    for (EventConsumerBusinessMethodItem businessMethod : messageConsumerBusinessMethods) {
        String invokerClass = EventBusConsumer.generateInvoker(businessMethod.getBean(), businessMethod.getMethod(), businessMethod.getConsumeEvent(), classOutput);
        messageConsumerConfigurations.put(invokerClass, annotationProxy.builder(businessMethod.getConsumeEvent(), ConsumeEvent.class).withDefaultValue("value", businessMethod.getBean().getBeanClass().toString()).build(classOutput));
        reflectiveClass.produce(new ReflectiveClassBuildItem(false, false, invokerClass));
    }
    Map<Class<?>, Class<?>> codecByClass = new HashMap<>();
    for (MessageCodecBuildItem messageCodecItem : codecs) {
        codecByClass.put(recorderContext.classProxy(messageCodecItem.getType()), recorderContext.classProxy(messageCodecItem.getCodec()));
    }
    recorder.configureVertx(vertx.getVertx(), messageConsumerConfigurations, launchMode.getLaunchMode(), shutdown, codecByClass);
    serviceStart.produce(new ServiceStartBuildItem("vertx"));
    return new VertxBuildItem(recorder.forceStart(vertx.getVertx()));
}
Also used : ServiceStartBuildItem(io.quarkus.deployment.builditem.ServiceStartBuildItem) HashMap(java.util.HashMap) GeneratedClassGizmoAdaptor(io.quarkus.deployment.GeneratedClassGizmoAdaptor) CoreVertxBuildItem(io.quarkus.vertx.core.deployment.CoreVertxBuildItem) ClassOutput(io.quarkus.gizmo.ClassOutput) ReflectiveClassBuildItem(io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem) ConsumeEvent(io.quarkus.vertx.ConsumeEvent) BuildStep(io.quarkus.deployment.annotations.BuildStep) Record(io.quarkus.deployment.annotations.Record)

Aggregations

GeneratedClassGizmoAdaptor (io.quarkus.deployment.GeneratedClassGizmoAdaptor)1 BuildStep (io.quarkus.deployment.annotations.BuildStep)1 Record (io.quarkus.deployment.annotations.Record)1 ServiceStartBuildItem (io.quarkus.deployment.builditem.ServiceStartBuildItem)1 ReflectiveClassBuildItem (io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem)1 ClassOutput (io.quarkus.gizmo.ClassOutput)1 ConsumeEvent (io.quarkus.vertx.ConsumeEvent)1 CoreVertxBuildItem (io.quarkus.vertx.core.deployment.CoreVertxBuildItem)1 HashMap (java.util.HashMap)1