negi_bb
negi_bb

Reputation: 1

How to connect a JS verticle and a Java verticle?

I am creating a Vertx verticle in JS(nodeJS) using es4x or vertx3-full package. I am using npm because of a npm-specific package. Now I have another verticle written in Java. I want these verticles to connect. How to do this?

Upvotes: 0

Views: 400

Answers (1)

Tcheutchoua Steve
Tcheutchoua Steve

Reputation: 556

From Vertx documentation

An application would typically be composed of many verticle instances running in the same Vert.x instance at the same time. The different verticle instances communicate with each other by sending messages on the event bus.

So basically you can

send a message from one verticle using eventBus.send(ADDRESS, message, sendMessageHander) and

consume it from the other verticle using eventBus.consumer(ADDRESS, receivedMessageHandler)

There is a fully runnable open source example here There is also publish/subscribe message patter that you can find in the documentation.

Upvotes: 2

Related Questions