Using Vertx Embedded inside of Docker Eventbus Problems

72 views
Skip to first unread message

Kevin Daly

unread,
Jul 28, 2016, 3:00:48 PM7/28/16
to vert.x
I am trying to use Vertx inside of a Docker compose application and I am finding the EventBus is not working at all..



Enter code here...
final VertxOptions options = new VertxOptions().setClusterManager(clusterManager);

if (Switches.isInContainer) {
logger.info("This node is running in a container with hostname ->"+info.getHostName()+" on port ->"+CONTAINER_PORT);
options.setClusterPublicHost(info.getHostName());
options.setClusterPublicPort(CONTAINER_PORT);
}

The cluster Manager is using Atomix and it is finding Atomix properly and working properly.

Is there any way to diagnose what is happening?

Paulo Lopes

unread,
Jul 29, 2016, 5:03:16 AM7/29/16
to vert.x
EB does work fine under docker compose (at least HZ does work out of the box without any custom config). Maybe the issue is related to atomix?

Tim Dörnemann

unread,
Jul 29, 2016, 7:07:19 AM7/29/16
to ve...@googlegroups.com
Hi Kevin,
I had the same issue when I tried to distribute my verticles to two containers. It turned out that the event bus did not bind to the machine's _public_ interface.
My solution was to run the container with "-h vertx" and then in vertx code resolve the hostname "vertx":
if(clusterHostname != null && !clusterHostname.isEmpty())
clusterHostname = InetAddress.getByName(clusterHostname).getHostAddress();
else
clusterHostname = InetAddress.getLocalHost().getHostAddress();

opts.setClusterManager(mgr);
opts.setClusterPort(clusterPort);
opts.setClusterHost(clusterHostname);
(clusterHostname is read from a config file and equals to "vertx")

Hope that helps.

Best, Tim

--
You received this message because you are subscribed to the Google Groups "vert.x" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vertx+un...@googlegroups.com.
Visit this group at https://groups.google.com/group/vertx.
To view this discussion on the web, visit https://groups.google.com/d/msgid/vertx/87cb386a-37c6-4294-acda-00d64ea571b3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Dr. Tim Dörnemann <tim.doe...@gmail.com>

GPG: 0797 2FF8 8142 53A6 C04D 1D61 2C1B 36EB 148A 6A51

Kevin Daly

unread,
Jul 29, 2016, 9:42:07 AM7/29/16
to vert.x
No luck, I've run it through the debugger and seems to be binding itself to the right port..

I don't see any logs for failed messages or anything.. 
Reply all
Reply to author
Forward
0 new messages