@@ -101,11 +101,15 @@ public static void streamExecutionEnvironmentConfig(StreamExecutionEnvironment s
101101 }
102102 });
103103
104- streamEnv .setRestartStrategy (RestartStrategies .failureRateRestart (
105- ConfigConstrant .failureRate ,
106- Time .of (ConfigConstrant .failureInterval , TimeUnit .MINUTES ),
107- Time .of (ConfigConstrant .delayInterval , TimeUnit .SECONDS )
108- ));
104+ if (isRestore (confProperties ).get ()){
105+ streamEnv .setRestartStrategy (RestartStrategies .failureRateRestart (
106+ ConfigConstrant .failureRate ,
107+ Time .of (getFailureInterval (confProperties ).get (), TimeUnit .MINUTES ),
108+ Time .of (getDelayInterval (confProperties ).get (), TimeUnit .SECONDS )
109+ ));
110+ } else {
111+ streamEnv .setRestartStrategy (RestartStrategies .noRestart ());
112+ }
109113
110114 // checkpoint config
111115 Optional <Boolean > checkpointingEnabled = isCheckpointingEnabled (confProperties );
@@ -163,6 +167,20 @@ public static Optional<Long> getAutoWatermarkInterval(Properties properties) {
163167 return StringUtils .isNotBlank (autoWatermarkInterval ) ? Optional .of (Long .valueOf (autoWatermarkInterval )) : Optional .empty ();
164168 }
165169
170+ public static Optional <Boolean > isRestore (Properties properties ){
171+ String restoreEnable = properties .getProperty (ConfigConstrant .RESTOREENABLE , "true" );
172+ return Optional .of (Boolean .valueOf (restoreEnable ));
173+ }
174+
175+ public static Optional <Integer > getDelayInterval (Properties properties ){
176+ String delayInterval = properties .getProperty (ConfigConstrant .DELAYINTERVAL , "10" );
177+ return Optional .of (Integer .valueOf (delayInterval ));
178+ }
179+ public static Optional <Integer > getFailureInterval (Properties properties ){
180+ String failureInterval = properties .getProperty (ConfigConstrant .FAILUREINTERVAL , "6" );
181+ return Optional .of (Integer .valueOf (failureInterval ));
182+ }
183+
166184 /**
167185 * #ProcessingTime(默认), IngestionTime, EventTime
168186 * @param properties
0 commit comments