You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何检查Spring Boot应用与Filenet的连接是否成功?

如何为Spring Boot应用实现Filenet连接健康检查?

我的Spring Boot应用通过Filenet Java SDK连接Filenet的功能正常,现在需要实现健康指示器来定期检查连接状态,核心问题是:如何可靠地验证与Filenet的连接是否成功?

已尝试的方案

  • 创建连接并获取ObjectStore:该操作始终返回成功,不会抛出任何错误,无法有效判断连接是否真的可用
Connection conn = com.filenet.api.core.Factory.Connection.getConnection("https://...");
Subject subject = UserContext.createSubject(conn, "User", "password", "jaasStanzaName");
UserContext uc = UserContext.get();
uc.pushSubject(subject);
ObjectStore os = Factory.ObjectStore.getInstance(Factory.Domain.getInstance(conn, null), "objectStoreName");
  • 执行SQL查询:该操作会在连接异常时抛出EngineRuntimeException,但我认为依赖异常处理来做健康检查属于不良代码实践
// 复用上述连接
SearchSQL sqlObject = new SearchSQL("SELECT * FROM ...");
SearchScope searchScope = new SearchScope(conn.getObjectStore());
IndependentObjectSet results = searchScope.fetchObjects(sqlObject, null, filter, true);

想请教是否有更合适的成熟方法或最佳实践可以采用?

内容的提问来源于stack exchange,提问作者Puck

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.02 09:01:04