public void handle(AsyncResult<Cluster> result) {
assertTrue(result.succeeded());
// Create a randomly named partial network. This is a network that has
// two components but no connections.
NetworkConfig network = vertigo.createNetwork();
network.addVerticle("sender", TestActiveSender.class.getName());
network.addVerticle("receiver", TestActiveReceiver.class.getName());
// When the network is deployed, the components will be deployed as normal,
// but they won't be able to communicate with each other since there's no
// connection on the network. Sending messages to the "sender"s "out" port
// will simply result in the messages disappearing.
result.result().deployNetwork(network, new Handler<AsyncResult<ActiveNetwork>>() {
@Override
public void handle(AsyncResult<ActiveNetwork> result) {
if (result.failed()) {
assertTrue(result.cause().getMessage(), result.succeeded());
} else {
// Now create a connection on the network. Both the "sender" and the
// "receiver" component will be automatically updated with the new
// connection, and messages send to the "sender"s "out" port will
// be sent to the "receiver"s "in" port.
ActiveNetwork network = result.result();
network.createConnection("sender", "out", "receiver", "in", new Handler<AsyncResult<ActiveNetwork>>() {
@Override
public void handle(AsyncResult<ActiveNetwork> result) {
if (result.failed()) {
assertTrue(result.cause().getMessage(), result.succeeded());
} else {