@Override
public InputPort port(String name) {
// Attempt to search for the port in the existing context. If the
// port isn't an explicitly configured port then lazily create
// and open the port. The lazy port will be empty.
InputPort port = ports.get(name);
if (port == null) {
log.debug(String.format("%s - Lazily creating in port: %s", this, name));
// Attempt to search for the port in the existing context. If the
// port isn't an explicitly configured port then lazily create
// and open the port. The lazy port will be empty.
InputPortContext portContext = context.port(name);
if (portContext == null) {
portContext = DefaultInputPortContext.Builder.newBuilder()
.setAddress(UUID.randomUUID().toString())
.setName(name)
.build();
DefaultInputContext.Builder.newBuilder((DefaultInputContext) context).addPort(portContext);
}
port = new DefaultInputPort(vertx, context.port(name));
if (started) {
port.open();
}
ports.put(name, port);
}
return port;
}