-1

this is not a real problem which needs help... but a discussion about the approach. Suppose i have a Java web application developed using vert.x which expose many REST services.

Would you deploy n REST verticles, each one reachable on its port and exposing his API?

or

would you just deploy one REST verticle and redirect calls internally using the event-bus and WebAPI?

Please explain why and if there's some detailed documentation or analysis.

Thank you

It's just thinking about how to do things

gdivella
  • 11
  • 4
  • If you are looking for help with Vert.x - feel free to reach out at https://consulting.aawadia.dev/ and we can set up some 1 on 1 sessions – Asad Awadia Jul 03 '23 at 00:57

2 Answers2

0

would you just deploy one REST verticle and redirect calls internally using the event-bus and WebAPI?

N verticles deployed all serving an http server on the same port. Each rest service is mounted as a subrouter on its service specific path

Asad Awadia
  • 1,417
  • 2
  • 9
  • 15
  • Not sure if this works automagically only by creating multiple HttpServers. I think one HttpServer will override the behaviour of the other. You can explicitly configure sub-routers, though. – Oliver Marienfeld Jul 01 '23 at 04:48
0

Vert.x recommends to encapsulate services as Verticles and use the EventBus for communication.

This gives you a lightweight separation of your services and scalability options:

  • If you deploy the services on one JVM, sending messages over the EventBus is merely as lightweight as a method call.
  • If you deploy in a Vert.x cluster (see Hazelcast, Infinispan, Zookeeper etc.), you won't have to change anything in your application - except for the deployment itself. And sending messages will still be relatively lightweight.

Start with one place where you configure HTTP routing. If the application grows and the single router becomes too messy, you can still separate that into Sub-Routers.

It’s not easy to give good advice without knowing your application. Vert.x does not force you into anything, though. So, if you find another approach that’s working it will be fine.

Oliver Marienfeld
  • 1,154
  • 9
  • 17