void overrideSmallRyeReactiveMessagingConfiguration()

in extensions/smallrye-reactive-messaging/deployment/src/main/java/org/apache/camel/quarkus/component/smallrye/reactive/messaging/deployment/SmallRyeReactiveMessagingProcessor.java [44:73]


    void overrideSmallRyeReactiveMessagingConfiguration(BuildProducer<AnnotationsTransformerBuildItem> transformers) {
        // Veto setup & configuration logic that is already handled by the camel-quarkus-reactive-streams extension
        transformers.produce(new AnnotationsTransformerBuildItem(context -> {
            if (context.isField()) {
                FieldInfo fieldInfo = context.getTarget().asField();
                ClassInfo classInfo = fieldInfo.declaringClass();

                // Make CamelReactiveStreamsService injectable from producers configured in the reactive-streams extension
                if (classInfo.name().equals(CAMEL_CONNECTOR_DOTNAME) && fieldInfo.name().equals("reactive")) {
                    AnnotationInstance injectAnnotation = getAnnotationInstance(DotNames.INJECT, fieldInfo);
                    context.transform().add(injectAnnotation).done();
                }
            }

            if (context.isMethod()) {
                MethodInfo methodInfo = context.getTarget().asMethod();
                ClassInfo classInfo = methodInfo.declaringClass();

                if (classInfo.name().equals(CAMEL_CONNECTOR_DOTNAME)) {
                    // Disable CamelReactiveStreamsService producer since the reactive-streams extension handles this
                    if (methodInfo.name().equals("getCamelReactive")) {
                        AnnotationInstance producesAnnotation = getAnnotationInstance(DotNames.PRODUCES, methodInfo);
                        context.transform()
                                .remove(annotationInstance -> annotationInstance.target().equals(producesAnnotation.target()))
                                .done();
                    }
                }
            }
        }));
    }