vert-x3 / vertx-examples

Vert.x examples
Apache License 2.0
3.55k stars 2.09k forks source link

camel-bridge-examples broken #411

Open cdennison opened 3 years ago

cdennison commented 3 years ago

Questions

Camel example appears to be broken for both 3.x and 4.x

Version

3.x

https://github.com/vert-x3/vertx-examples/commit/31530f59aeda6344392a87968cedaf1960f65e52

4.x

https://github.com/vert-x3/vertx-examples/commit/be4a5ddac93c4a143e4b09386ecc3d1b285e7b44

Steps to reproduce

3.x

maven clean package

$ java -jar target/ run io.vertx.example.camel.rmi.RMIExample camel-bridge-examples-3.9.0.jar maven-archiver/ classes/ maven-status/ generated-sources/ original-camel-bridge-examples-3.9.0.jar C02Y75JAJGH5:camel-bridge-examples dennch3$ java -jar target/camel-bridge-examples-3.9.0.jar run io.vertx.example.camel.rmi.RMIExample SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder". SLF4J: Defaulting to no-operation (NOP) logger implementation SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details. Jan 13, 2021 10:56:36 AM org.springframework.context.support.AbstractApplicationContext prepareRefresh INFO: Refreshing org.springframework.context.support.ClassPathXmlApplicationContext@20e8ccf0: startup date [Wed Jan 13 10:56:36 EST 2021]; root of context hierarchy Jan 13, 2021 10:56:36 AM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions INFO: Loading XML bean definitions from class path resource [META-INF/spring/camelContext.xml] Jan 13, 2021 10:56:36 AM org.springframework.core.io.support.PropertiesLoaderSupport loadProperties INFO: Loading properties file from class path resource [myapp.properties] Jan 13, 2021 10:56:37 AM io.vertx.core.impl.launcher.commands.VertxIsolatedDeployer INFO: Succeeded in deploying verticle

$ curl http://localhost:8080/?name=world No handlers for address invocation

4.x

$ java -jar target/camel-bridge-examples-4.0.0.jar run io.vertx.example.camel.rmi.RMIExample Jan 13, 2021 11:03:22 AM org.springframework.context.support.AbstractApplicationContext prepareRefresh INFO: Refreshing org.springframework.context.support.ClassPathXmlApplicationContext@50a55bad: startup date [Wed Jan 13 11:03:22 EST 2021]; root of context hierarchy Jan 13, 2021 11:03:22 AM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions INFO: Loading XML bean definitions from class path resource [META-INF/spring/camelContext.xml] Jan 13, 2021 11:03:22 AM io.vertx.core.impl.launcher.commands.VertxIsolatedDeployer SEVERE: Failed in deploying verticle org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from class path resource [META-INF/spring/camelContext.xml]; nested exception is java.lang.NoClassDefFoundError: org/apache/camel/impl/DefaultCamelBeanPostProcessor

Extra

OSX, Java 1.8, Maven 3.6.3

mattirn commented 2 years ago

IMHO, camel-bridge is broken in vertx v4.x. The following does not work

    public void testCamelBridge() throws Exception {
        CamelContext camelContext = new DefaultCamelContext();
        camelContext.addRoutes(new RouteBuilder() {
            @Override
            public void configure() {
                from("direct:start").transform(constant("OK"));
            }
        });
        camelContext.start();

        VertxOptions vertxOptions = new VertxOptions();
        vertxOptions.setEventLoopPoolSize(4);
        vertxOptions.setWorkerPoolSize(4);
        Vertx vertx = Vertx.vertx(vertxOptions);
        CamelBridge bridge = CamelBridge.create(vertx, new CamelBridgeOptions(camelContext)
                .addOutboundMapping(OutboundMapping.fromVertx("test").toCamel("direct:start")));
        bridge.start();
        vertx.eventBus().request("test", "hello", reply -> LOG.info("reply.result().body():{}"
                , reply.result() != null ? reply.result().body() : "null"));

    }

Executing the method will trace INFO reply.result().body():null while when running in vertx v3.x (replace vertx.eventBus().request( ... ) with vertx.eventBus().send( ... )) it will trace INFO reply.result().body():OK as expected.

In vertx v4.x I'm having camel v3.x and vertx v3.x camel v2.x if that matters.

See, https://github.com/vert-x3/vertx-camel-bridge/issues/48