What is the best way to communicate between microservices in vertx, by web client or some middleware?

后端 未结 1 733
我在风中等你
我在风中等你 2021-01-16 06:59

I have not done much in vert.x microservices, but I ran into the doubt of knowing the best way to communicate with each other miscroservices vert.x, using some middleware or

相关标签:
1条回答
  • 2021-01-16 07:20

    There's an infinite of possibilities to allow vert.x microservices to communicate between them, each with pros and cons and with more or less relevance depending on the context.

    Here is 3 common ways :

    1) Using the native vert.x eventBus ( asynchronous logic) : https://vertx.io/docs/vertx-core/java/#event_bus (and you can use the Hazelcast Cluster Manager using the -cluster option when you need to handle communication between different JVM pids : https://vertx.io/docs/vertx-hazelcast/java/ ).

    2) Using a messages broker system like Apache Kafka ( sometimes you need persistent message queues with replay mechanisms, which I think is more powerful than the vert.x's event bus, sometimes you need to communicate with multiple languages written microservices and the vert.x event bus is not relevant to do that) or an old fashion JMS compliant system like ActiveMQ, RabbitMQ & cie.

    3) Sometimes it's more relevant to expose simple Restful api, so you can use the vertx-web extension to do that : https://vertx.io/docs/vertx-web/java/

    0 讨论(0)
提交回复
热议问题