My Spring Boot application should connect to Filenet, which it is doing fine with the Filenet Java SDK. Now I'd like to implement a health indicator, to periodically check if the connection is still okey. Which leads me to my question:
How do I check if the connection to Filenet is successful?
What I've already tried
Creating a connection and checking if I can get the ObjectStore, which always works and never throws any error:
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");
Trying to do any SQL query works sort of, because it throws an EngineRuntimeException
.
// Same connection as above
SearchSQL sqlObject = new SearchSQL("SELECT * FROM ...");
SearchScope searchScope = new SearchScope(conn.getObjectStore());
IndependentObjectSet results = searchScope.fetchObjects(sqlObject, null, filter, true);
But using an Exception for logic and method flows seems to me like bad code.
So are there any good methods or tried practices that I am missing?
Thanks in advance