I am handling a large query of a Salesforce object through SOAP API which takes more than the timeout. Frequent error message is INVALID_SESSION_ID. I have used the queries throughout every code and it is quite cumbersome to parse the exception message on every request that is used in my code. Are there elegant solutions on handling invalid session? Docs still don't answer this question.
I thought of implementing a session renewer where I run a ScheduledThreadExecutor prior to timeout. However, the timeout can be for every 15 minutes (I prefer not to overfit this scenario where the timeout is 120 minutes and I renew the session for every 15 minutes). Is there a way that I can access this info that is present in the Salesforce settings page. Are there any existing session renewer implementations that automatically connect after the error?