0
votes

I am in the process of learning Vert.x.

So I want to create a dashboard app for GPS tracker. I intend to create 3 verticles:

  • 1 for getting data from the device and serializing it. And then this vertices will publish it to others via the event bus
  • 1 for reading and writing the database. This vertices will be used as a normal Web API for web client, too.
  • 1 for giving real time update (using websocket) to the web client.

I want only 1 verticle have access to the database. But the other two sometimes need access to the database (authorization mostly). And I thought, I just request it, using the request-reply pattern, from this 1 verticle with database access.

But isn't req-rep pattern a blocking operation?? Does it affecting performance in long term?? Or should I just let every verticles have acccess to database??

2

2 Answers

0
votes

Request/reply is a pattern that involves two messages related to each other. It doesn't imply that the corresponding is blocking.

If you're getting started with Vert.x, I would recommend to keep things simple and use a single verticle that implements the Web API, the Websocket for realtime updates and the database interactions.

0
votes

Eclipse Vert.x is event driven and non blocking. Write each block of you commands in Promise/Future pattern. In my current project I have Auth service with own db, notification service with own db, registration with own db each service may have or not own db. If one need data from another it will call data provider service. No service have access to DB except one owner.

But isn't req-rep pattern a blocking operation?? - no, vertx is event driven Does it affecting performance in long term?? - not sure, what you mean. if you write microservice with small resource then why you should have performance issue? but programming not limited by you vision and everything possible.

Or should I just let every verticles have acccess to database?? - you may let them but How you will catch issues in future? DB is storage with functions. I wrote that one DB have one persistance service is it easier to control, and sure verticals can be replicated.