'Implementing and Deploying Microservices as Vertxs or Verticles and Inter service communication

I am very new to Vertx and Verticles, but have some experience with Springboot microservices.

I am implementing a solution with the following components and responsibilities (trying to simplify the architecture):

  1. Web UI: sends Ajax requests via security proxy to Search broker
  2. Security Proxy: Acts as the external interface to the Search Nodes
  3. Search Broker: receives a request from UI and delegates to Search Service
  4. Search Service : This is a kind of data/document access service, that modifies request query params based on JWT token, mitigates cross site scripting issues and any OWASP type vulnrabilty, queries multiple collections against a SOLR Cloud cluster and aggregates the documents returned.
  5. Solr Cloud: SolrCloud is flexible distributed search and indexing, without a master node to allocate nodes, shards and replicas. Instead, Solr uses ZooKeeper to manage these locations, depending on configuration files and schemas.

The flow of control is UI > Proxy > Broker (Could be Broker to broker) > Search Service > Solr Cloud

Moreover, The user request can be routed from broker to local search and solr service, and the request could also be routed to multiple brokers on separate machines and networks etc

Please, let me take the UI and Security Proxy out of the integration flow to simply my explanation.

I have created git repos for all the above components (standard microservice practice), and I will focus my analogy on the broker and search microservices. I have also installed the SOLR cloud and can interact with the SOLR instance from a standalone vertx application, quick code!

My problem is with implementing inter-service communication between my vertx applications i.e. expose the broker service with RESTful endpoint URI mappings, so my UI requests could hit the broker vertx/verticle and delegate search requests to the Search service vertx/verticle microservice.

The implementation of Vertx inter-service communication, I saw was mainly https://www.baeldung.com/spring-vertx, where you create a vertx application (which in my case has 2 verticles, broker and search verticles), as a monolith.

The main app for the vertx-spring-eventbus inter service communication architecture is below, adapted to my scenario:

@SpringBootApplication
@Configuration
@ComponentScan(basePackages = { "x.y.z" })
public class VertxSpringApplication {

    @Autowired
    private BrokerVerticle brokerVerticle;

    @Autowired
    private SearchVerticle solrSearchVerticle;

    public static void main(String[] args) {
        SpringApplication.run(VertxSpringApplication.class, args);
    }

    @PostConstruct
    public void deployVerticle() {
        final Vertx vertx = Vertx.vertx();
        vertx.deployVerticle(brokerVerticle);
        vertx.deployVerticle(solrSearchVerticle);
    }

I got that the above working, as a monolith, i.e. single vertx application, with 2 verticles communicating over eventbus, in a single gitlab repository.

But, I wanted each component microservice to have its own git repository, for independent build and deployment, CI/CD etc

So, I created 2 git repos, basically replicating https://github.com/eugenp/tutorials/tree/master/spring-vertx, with one being the sender vertx and the other the consumer vertx. That did not work (they could not communicate), because apparently the eventbus communication cannot be shared across multiple vertx instances/apps.

To keep the separate repo setup, I could create search service as a maven dependency, so I could use the dependecy in the sender maven application, but wont be enjoying the full spring bean IoC etc

If I created a verticle per microservice or web service, I will be confined to a single git repo and implementing a monolith as a result, since I can only execute interservice communication via one eventbus.

Basically something similar to the springboot rest-template will be ideal, but the following https://github.com/hubrick/vertx-rest-client is for vertx 3.x.x and not sure if can be used in a full production environment.

Please, could you advise of the best vertx/verticle/git repo/inter-service communication architecture for my use-case?

Also any code resources or docs will be appreciated.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source