Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to get camel-bridge working in vertx v4.x #48

Closed
mattirn opened this issue Jun 10, 2022 · 3 comments
Closed

Failed to get camel-bridge working in vertx v4.x #48

mattirn opened this issue Jun 10, 2022 · 3 comments
Labels

Comments

@mattirn
Copy link

mattirn commented Jun 10, 2022

Version

vertx v4.x

Context

I'm not able to make working camel-bridge component in vertx v4.x

Do you have a reproducer?

    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 reply.succeeded()=false, stack from reply.cause():

(NO_HANDLERS,-1) No handlers for address test
        at io.vertx.core.eventbus.impl.EventBusImpl.deliverMessageLocally(EventBusImpl.java:359)
        at io.vertx.core.eventbus.impl.EventBusImpl.sendLocally(EventBusImpl.java:319)
        at io.vertx.core.eventbus.impl.EventBusImpl.sendOrPub(EventBusImpl.java:307)
        at io.vertx.core.eventbus.impl.OutboundDeliveryContext.next(OutboundDeliveryContext.java:131)
        at io.vertx.core.eventbus.impl.EventBusImpl.sendOrPubInternal(EventBusImpl.java:394)
        at io.vertx.core.eventbus.impl.EventBusImpl.sendOrPubInternal(EventBusImpl.java:400)
        at io.vertx.core.eventbus.impl.EventBusImpl.request(EventBusImpl.java:111)
        at io.vertx.core.eventbus.EventBus.request(EventBus.java:95)
        at io.vertx.core.eventbus.EventBus.request(EventBus.java:74)
...

Extra

In vertx v4.1.0 I'm having camel v3.11.0 and vertx v3.7.1 camel v2.53.3 if that matters.

@vietj
Copy link
Contributor

vietj commented Jun 13, 2022

@davsclaus can you have a look ?

@davsclaus
Copy link
Contributor

Added unit test - you need to start the bridge and camel in correct order, or wait for the bridge to be up and running

See the unit test
https://github.com/vert-x3/vertx-camel-bridge/blob/master/src/test/java/io/vertx/camel/Issue48Test.java

@mattirn
Copy link
Author

mattirn commented Jun 14, 2022

Thanks @davsclaus, starting the bridge and camel in correct order solves the problem. Wait for the bridge to be up running does not i.e. when I replaced in my example above bridge.start() with BridgeHelper.startBlocking(bridge) I will get the same exception as before.

We create camelContext bean using XML DSL and it will be automatically started. So my options to resolve the problem are:

  1. set camelContext field autoStartup="false" in XML DSL, define vertx-camel-bridges and finally start manually camelContext and all the routes.
  2. stop camelContext, define vertx-camel-bridges and finally start camelContext

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

3 participants