简体   繁体   中英

Problems configuring clustered Vertx Eventbus in Quarkus

I'm using:

  • Quarkus 1.6.1.Final
  • Vertx 3.9.1 (provided by quarkus-vertx dependency, see pom.xml below)

And I can't get the clusered Eventbus working. I've followed the instructions listed here:

https://vertx.io/docs/vertx-hazelcast/java/

I've also enabled clustering in Quarkus:

quarkus.vertx.cluster.clustered=true
quarkus.vertx.cluster.port=8081
quarkus.vertx.prefer-native-transport=true
quarkus.http.port=8080

And here is my pom.xml:

    <dependencies>
    <dependency>
        <groupId>io.quarkus</groupId>
        <artifactId>quarkus-resteasy</artifactId>
    </dependency>
    <dependency>
        <groupId>io.quarkus</groupId>
        <artifactId>quarkus-resteasy-mutiny</artifactId>
    </dependency>
    <dependency>
        <groupId>io.quarkus</groupId>
        <artifactId>quarkus-vertx</artifactId>
    </dependency>
    <dependency>
        <groupId>io.vertx</groupId>
        <artifactId>vertx-hazelcast</artifactId>
        <version>3.9.2</version>
        <exclusions>
            <exclusion>
                <groupId>io.vertx</groupId>
                <artifactId>vertx-core</artifactId>
            </exclusion>
            <!--                <exclusion>-->
            <!--                    <groupId>com.hazelcast</groupId>-->
            <!--                    <artifactId>hazelcast</artifactId>-->
            <!--                </exclusion>-->
        </exclusions>
    </dependency>
  <!--        <dependency>-->
  <!--            <groupId>com.hazelcast</groupId>-->
  <!--            <artifactId>hazelcast-all</artifactId>-->
  <!--            <version>3.9</version>-->
  <!--        </dependency>-->
    <dependency>
        <groupId>io.netty</groupId>
        <artifactId>netty-transport-native-epoll</artifactId>
        <classifier>linux-x86_64</classifier>
    </dependency>      
   </dependencies>

And the error I get is the following:

Caused by: java.lang.ClassNotFoundException: com.hazelcast.core.MembershipListener

As you can see in my pom.xml, I've also added the dependency hazelcast-all:3.9 and excluded the hazelcast dependency from vertx-hazelcast:3.9.2, then this error disappears but another comes up:

Caused by: com.hazelcast.config.InvalidConfigurationException: cvc-complex-type.2.4.a: Invalid content was found starting with element '{"http://www.hazelcast.com/schema/config":memcache-protocol}'. One of '{"http://www.hazelcast.com/schema/config":public-address, "http://www.hazelcast.com/schema/config":reuse-address, "http://www.hazelcast.com/schema/config":outbound-ports, "http://www.hazelcast.com/schema/config":join, "http://www.hazelcast.com/schema/config":interfaces, "http://www.hazelcast.com/schema/config":ssl, "http://www.hazelcast.com/schema/config":socket-interceptor, "http://www.hazelcast.com/schema/config":symmetric-encryption, "http://www.hazelcast.com/schema/config":member-address-provider}' is expected.

Am I doing something wrong or forgetting something, or is this simply a bug in Quarkus or in Vertx?

Thx in advance for any help.

I think the most probable reason of your issue is that you are using the quarkus-universe-bom which enforces a version of Hazelcast (we have an Hazelcast extension there) which is not compatible with vertx-hazelcast .

Check your dependency tree with mvn dependency:tree and make sure the Hazelcast artifacts are of the version required by vertx-hazelcast .

Another option would be to simply use the quarkus-bom which does not enforce an Hazelcast version and let vertx-hazelcast drag the dependency by itself.

It seems like a bug in Quarkus and this issue is related to:

https://github.com/quarkusio/quarkus/issues/10889

Bringing this from its winter sleep...

I am looking to use quarkus 2 + vert.x 4 and use either the shared data vert.x api or vert.x cluster manager in order to achieve an in-process, distributed cache (as opposed to an external dist. cache cluster)

What's unclear to me, also by looking at the git issue described above (thats still open), is if I can count on these APIs working for me at this time with the versions I mentioned.

Any comments will be great!

Thanks in advance...

[UPDATE]: looks like the clustered cache works with no issues using the shared data API along with quarkus, vertx, hazlecast & mutiny bindings for vertx (all with latest versions).

all I needed to do is set quarkus.vertx.cluster.clustered=true in quarkus properties file, use vertx.sharedData().getClusterWideMap implementation for the distrubuted cache and add gradle/maven 'io.vertx:vertx-hazelcast:4.3.1' support.

in general, thats all it took for a small poc code. thanks

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM