There is a comment in the ISession documentation for .NET of “Connect and disconnect on demand” but no more detail on that.
Currently our app has:
- Code at service startup to initialise Solace, create session, call ISession.Connect()
- Additional threads utilising that ISession to create guaranteed message flows etc.
The problem we are seeing right now is that ISession.Connect() is failing (which is expected due to some infrastructure not yet being ready). What is not clear to me is what we should be doing about that - at the moment we just log it out and continue. So our additional application threads are each doing calls like ISession.CreateFlow() and of course also getting failures of OperationErrorException. They each have their own retry logic - so every x interval they try again to call ISession.CreateFlow()
My questions are:
- If the connectivity magically becomes possible (i.e. our infrastructure issues are sorted), will that repeated ISession.CreateFlow() call be sufficient to initialise the session connection, without another attempted call to ISession.Connect()?
- If that is the case then is ISession.Connect() really an “optional” call that offers the early ability to do a health check but it isn’t necessary to block any application code from continuing to “try” to use that session?
Basically I am trying to determine what sort of “recovery” mechanism we need to have in place in our codebase to retain the integrity of our application, without having to restart our services if Solace connectivity happens to be down for a moment in time. If the Solace API is for the most part “self-recovering” in terms of just throwing exceptions while connectivity is down but internally reconnecting when possible so subsequent API calls will work then all we need is retry logic when seeing those exceptions. However if instead for instance the ISession instance needs disposing/recreating until you get a valid connection etc then that requires a whole different approach.