void overrideSmallRyeReactiveMessagingConfiguration()

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


    void overrideSmallRyeReactiveMessagingConfiguration(BuildProducer<AnnotationsTransformerBuildItem> transformers) {
        // Veto setup & configuration logic that is already handled by the camel-quarkus-reactive-streams extension
        transformers.produce(new AnnotationsTransformerBuildItem(new AnnotationTransformation() {
            @Override
            public void apply(TransformationContext context) {
                Declaration declaration = context.declaration();
                if (declaration.kind().equals(AnnotationTarget.Kind.FIELD)) {
                    FieldInfo fieldInfo = declaration.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.add(injectAnnotation);
                    }
                }

                if (context.declaration().kind().equals(AnnotationTarget.Kind.METHOD)) {
                    MethodInfo methodInfo = declaration.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.remove(
                                    annotationInstance -> annotationInstance.target().equals(producesAnnotation.target()));
                        }
                    }
                }
            }
        }));
    }