This is how I build ActorSystem in Flink 1.8.5.
public static ActorSystem createNewActorSystem() throws Exception {
String ip = HostPortUtil.getLocalIp();
Configuration configuration = new Configuration();
configuration.setString(MetricOptions.QUERY_SERVICE_PORT, portRange);
// remote actorsystem
ActorSystem actorSystem = MetricUtils.startMetricsActorSystem(configuration, ip, logger);
return actorSystem;
}
And I want to build ActorSystem in Flink 1.13.5?
How should I modify the code?
I check the document and try to use RobustActorSystem class to build ActorSystem. However, it is totally different.
So I have no idea how to fix this.
In Flink 1.13.5, the RobustActorSystem
requires a logger (docs)
, so you need to deal with it:
import org.apache.flink.runtime.metrics.util.RobustActorSystem;
import org.apache.flink.configuration.Configuration;
import org.apache.flink.runtime.metrics.util.MetricUtils;
import org.apache.flink.runtime.metrics.util.MetricUtils.Logging;
import org.apache.flink.util.HostPortUtil;
public static ActorSystem createNewActorSystem() throws Exception {
String ip = HostPortUtil.getLocalIp();
Configuration configuration = new Configuration();
configuration.setString(MetricOptions.QUERY_SERVICE_PORT, portRange);
Logging logger = new Logging();
ActorSystem actorSystem = RobustActorSystem.createActorSystem(configuration, ip, logger);
return actorSystem;
}