当某种推送未正确配置,不能正常初始化时,打印日志,但不退出
This commit is contained in:
@@ -25,12 +25,18 @@ public class FCMPush {
|
||||
|
||||
@PostConstruct
|
||||
private void init() throws Exception {
|
||||
try {
|
||||
|
||||
FileInputStream refreshToken = new FileInputStream(mConfig.getCredentialsPath());
|
||||
FirebaseOptions options = FirebaseOptions.builder()
|
||||
.setCredentials(GoogleCredentials.fromStream(refreshToken))
|
||||
.setDatabaseUrl("https://<DATABASE_NAME>.firebaseio.com/")
|
||||
.build();
|
||||
FirebaseApp.initializeApp(options);
|
||||
} catch (Exception e) {
|
||||
LOG.error("FCMPush init failed");
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -48,21 +48,26 @@ public class GetuiPush {
|
||||
|
||||
@PostConstruct
|
||||
public void init() {
|
||||
// 设置httpClient最大连接数,当并发较大时建议调大此参数。或者启动参数加上 -Dhttp.maxConnections=200
|
||||
System.setProperty("http.maxConnections", "200");
|
||||
GtApiConfiguration apiConfiguration = new GtApiConfiguration();
|
||||
//填写应用配置
|
||||
if(!StringUtils.isEmpty(mConfig.getAppId())) {
|
||||
apiConfiguration.setAppId(mConfig.getAppId());
|
||||
apiConfiguration.setAppKey(mConfig.getAppKey());
|
||||
apiConfiguration.setMasterSecret(mConfig.getMasterSecret());
|
||||
// 接口调用前缀,请查看文档: 接口调用规范 -> 接口前缀, 可不填写appId
|
||||
apiConfiguration.setDomain("https://restapi.getui.com/v2/");
|
||||
// apiConfiguration.setDomain(mConfig.getDomain());
|
||||
// 实例化ApiHelper对象,用于创建接口对象
|
||||
ApiHelper apiHelper = ApiHelper.build(apiConfiguration);
|
||||
// 创建对象,建议复用。目前有PushApi、StatisticApi、UserApi
|
||||
this.pushApi = apiHelper.creatApi(PushApi.class);
|
||||
try{
|
||||
// 设置httpClient最大连接数,当并发较大时建议调大此参数。或者启动参数加上 -Dhttp.maxConnections=200
|
||||
System.setProperty("http.maxConnections", "200");
|
||||
GtApiConfiguration apiConfiguration = new GtApiConfiguration();
|
||||
//填写应用配置
|
||||
if(!StringUtils.isEmpty(mConfig.getAppId())) {
|
||||
apiConfiguration.setAppId(mConfig.getAppId());
|
||||
apiConfiguration.setAppKey(mConfig.getAppKey());
|
||||
apiConfiguration.setMasterSecret(mConfig.getMasterSecret());
|
||||
// 接口调用前缀,请查看文档: 接口调用规范 -> 接口前缀, 可不填写appId
|
||||
apiConfiguration.setDomain("https://restapi.getui.com/v2/");
|
||||
// apiConfiguration.setDomain(mConfig.getDomain());
|
||||
// 实例化ApiHelper对象,用于创建接口对象
|
||||
ApiHelper apiHelper = ApiHelper.build(apiConfiguration);
|
||||
// 创建对象,建议复用。目前有PushApi、StatisticApi、UserApi
|
||||
this.pushApi = apiHelper.creatApi(PushApi.class);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
LOG.error("GetuiPush init failed");
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -25,7 +25,13 @@ public class MeiZuPush {
|
||||
|
||||
@PostConstruct
|
||||
public void init() {
|
||||
this.flymePush = new IFlymePush(mConfig.getAppSecret());
|
||||
try {
|
||||
//初始化推送sdk
|
||||
this.flymePush = new IFlymePush(mConfig.getAppSecret());
|
||||
} catch (Exception e) {
|
||||
LOG.error("MeiZuPush init failed");
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Autowired
|
||||
|
||||
@@ -30,6 +30,7 @@ public class OppoPush {
|
||||
try {
|
||||
mSender = new Sender(mConfig.getAppKey(), mConfig.getAppSecret());
|
||||
} catch (Exception e) {
|
||||
LOG.error("OppoPush init failed");
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,13 +21,8 @@ import org.springframework.util.StringUtils;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.security.InvalidKeyException;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.util.Calendar;
|
||||
|
||||
import static java.lang.System.exit;
|
||||
|
||||
@Component
|
||||
public class ApnsServer {
|
||||
private static final Logger LOG = LoggerFactory.getLogger(ApnsServer.class);
|
||||
@@ -110,13 +105,9 @@ public class ApnsServer {
|
||||
.build();
|
||||
}
|
||||
}
|
||||
} catch (IOException e) {
|
||||
} catch (Exception e) {
|
||||
LOG.error("ApnsServer init failed");
|
||||
e.printStackTrace();
|
||||
exit(-1);
|
||||
} catch (NoSuchAlgorithmException e) {
|
||||
throw new RuntimeException(e);
|
||||
} catch (InvalidKeyException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user