for (OutputPortContext output : context.ports()) {
if (ports.containsKey(output.name())) {
((DefaultOutputPort) ports.get(output.name())).open(startCounter);
} else {
final OutputPort port = new DefaultOutputPort(vertx, output);
log.debug(String.format("%s - Opening out port: %s", DefaultOutputCollector.this, output));
port.open(new Handler<AsyncResult<Void>>() {
@Override
public void handle(AsyncResult<Void> result) {
if (result.failed()) {
log.error(String.format("%s - Failed to open out port: %s", DefaultOutputCollector.this, port));
startCounter.fail(result.cause());
} else {
log.info(String.format("%s - Opened out port: %s", DefaultOutputCollector.this, port));
ports.put(port.name(), port);
startCounter.succeed();
}
}
});
}