final Vertigo vertigo = new Vertigo(this);
vertigo.deployCluster(new Handler<AsyncResult<Cluster>>() {
@Override
public void handle(AsyncResult<Cluster> result) {
assertTrue(result.succeeded());
final Cluster cluster = result.result();
// Use the special EventBusHookListener to listen for messages
// from the event bus hook. This will handle parsing event bus messages.
final EventBusHookListener listener = new EventBusHookListener("test-hook", vertx.eventBus());
listener.startHandler(new Handler<InstanceContext>() {
@Override
public void handle(InstanceContext context) {
assertEquals("sender", context.component().name());
testComplete();
}
});
// The start() method simply registers an event bus handler for the hook.
listener.start(new Handler<AsyncResult<Void>>() {
@Override
public void handle(AsyncResult<Void> result) {
assertTrue(result.succeeded());
NetworkConfig network = vertigo.createNetwork();
network.addComponent("sender", TestSimpleSender.class.getName()).addHook(new EventBusHook("test-hook"));
network.addComponent("receiver", TestSimpleReceiver.class.getName());
network.createConnection("sender", "out", "receiver", "in");
cluster.deployNetwork(network, new Handler<AsyncResult<ActiveNetwork>>() {
@Override
public void handle(AsyncResult<ActiveNetwork> result) {
if (result.failed()) {
assertTrue(result.cause().getMessage(), result.succeeded());
} else {