public Construct exec(Target t, Environment environment, Construct... args) throws ConfigRuntimeException { String name = args[0].val(); String endpoint = args[1].val(); int type = ZMQ.PUB; if (args.length == 3) { String stype = args[2].val().toUpperCase(); if (!"PUB".equals(stype) && !"SUB".equals(stype)) { throw new ConfigRuntimeException( "You must specify PUB or SUB" + " for comm_listen's third argument!", Exceptions.ExceptionType.NotFoundException, t); } if ("SUB".equals(stype)) { type = ZMQ.SUB; } } NodePoint node; DaemonManager daemon = environment.getEnv(GlobalEnv.class).GetDaemonManager(); try { node = Tracking.getOrCreate(daemon, type, name); } catch (InvalidNameException ex) { throw new ConfigRuntimeException( "Invalid name " + name + " given to comm_listen!", Exceptions.ExceptionType.FormatException, t); } try { node.listen(endpoint); } catch (ZMQException e) { throw new ConfigRuntimeException( "Exception while listening: " + e.getMessage(), Exceptions.ExceptionType.IOException, t); } return CNull.NULL; }