Service proxy with multiple implementations

25 views
Skip to first unread message

Marcin Czeczko

unread,
Jan 11, 2017, 7:34:05 AM1/11/17
to vert.x
Hi,

Does anyone have an idea, how to create service proxy having multiple implementations ?
What I mean, is to have two distinct verticles, e.g. A & B, each having it's own implementations of one service interface (and having service method void process(JsonObject, Handler handler)). 
So, in the third verticle that is about to talk with A or B, I could somehow create proxy to serviceAImpl or serviceBImpl based on some logic, e.g. depending on current configuration.

What I found is that, I can create distinct service interfaces for A & B, but when I wanted to use in the third verticle, I'd need to explicitly specify interface A or B when creating proxy.

jan.ker...@braintags.de

unread,
Jan 11, 2017, 10:20:01 AM1/11/17
to vert.x
If your are using the Service discovery this is easy. When you publish your service from verticle a or b, add metadata to the record you publish, specifying which impl this records belongs to. You need to publish your verticles at different  eventbus-addresses tho. 
When you you dont use the service discovery, you could do the same, just use different address. But you need to know the address used by your verticles. 
Reply all
Reply to author
Forward
0 new messages