Herget
Herget

Reputation: 165

Master-Worker System in Vert.X

Since I do not find any good tutorial: I want to build a Master-Worker System with Vert.x. Therefore, I start a Master JAR which has a web frontend and some services to share information. Now I want to start a worker (first on the same local server) which should connect to the Master verticle so they share the same event loop, that the worker can do the tasks which the master shares.

How do I add an external verticle to the master's event loop?

Upvotes: 0

Views: 79

Answers (1)

tsegismont
tsegismont

Reputation: 9128

You can't connect a worker Vert.x process and share an event loop with a master Vert.x process. An event loop is a thread, and a thread belongs to a process.

If you have tasks that the frontend should delegate to workers, you should isolate the task code in a verticle and make the master verticle communicate with it over the event bus.

As you said, in the beginning you can put the two verticles in the same process. And then you can start to cluster Vert.x and deploy the worker verticle on other nodes. The event bus will take care of load balancing the messages.

Upvotes: 0

Related Questions