What is the best way to share data in Vert.x between verticles? I'm mostly interested in low-overhead, direct, concurrent access. Event system doesn't seem to be appropriate when multiple verticles need to access to the things that are big enough not to be economical to be sent as json.
Simple example - consider an imaginary postal service using Vert.x. Say it has two verticles: one to figure out the next package to send and another to figure out the fuel spent in the previous hour by the vehicles delivering packages.
Say there are 1000s of packages at any given moment. There could be a database returning these, but then it would need to return all of the packages, as algorithms for determining which package to send / fuel spent are complex enough and being executed by two verticles.
So far I've found these:
- Vert.x Equivalent to the Node.js Global object
- Clustering and Shared Data in Vert.x
- https://groups.google.com/forum/#!topic/vertx/fyVvWRzeqJU
Some suggestions are:
- Use
JSON.stringify
/JSON.parse
throughvertx.getMap
. This looks like quite an overhead for me, especially when things are updated often (e.g. package location can contain a GPS coordinate) - Use EHCache, Hazelcast, etc., but these mostly die off with a "you can try" conclusion without details
Is there a canonical Vert.x solution here that I failed to recognize? I'm OK with dividing things in a different manner, having more verticles, lower / higher granularity, etc., if that's the way to go - i.e. this is more an architectural question with regard to Vert.x model.
I'm also interested to see open source examples related to the above, if any.