Having Trouble with connection retries? not able to reconnect ?
Hi, my application is running 10 consumers with a session. I tried to simulate connection retry mechanism but could not do it. Also I want to log retry events. Here are values. -Using 1 Host only.
I took down internet connectivity in order to kick on this mechanism.
ReconnectRetries set to 10
ConnectRetriesPerHost set to 10
ConnectTimeoutInMsecs set to 3000
but I saw no connection request been made and also handled session events but this does not work. what could possibly be wrong.
Answers
-
Which language / API?
What is your logging setup?
Another way of simulating the connection going down is to either a) shutdown the whole Message VPN (not possible in Solace Cloud though); or b) shutdown the client username your app is using.
0 -
Using DotNet APi. Basically written my own simple file based logger that catches the event from Solace Session and Flows and writes them in file.
case SessionEvent.Reconnecting:Logger.Instance.Log(LogSectionType.POC, LogType.Info,$"Solace Event: session is reconnecting: {e.Info}");
break;
will this event hit while reconnecting everytime. I tweaked setting multiple times but it only hit like 1 more time despite I had setup these values now.ReconnectRetries = 10,
ConnectRetriesPerHost = 10,
ConnectTimeoutInMsecs = 60000
0 -
I'm not sure. Does the reconnect happen if you leave all the values default? I'm assuming probably not still..?
I just tried with a local Java app, and shut off my WiFI, and it took maybe 15-20 seconds to start the reconnect procedure. Not as fast as shutting down access to the broker. Maybe as another way to test: just shutdown/disable the client username your app is using to connect?
Take a look at these to see if they may help?
And here's the sample they're referring to.
0 -
I set the logging to debug level but its working as it supposed too. I have waited for the timeout but second attempt never logs in the service. Can it be related to blocking connect call ? I guess there seems to be problem there since upon multiple runs I was unable to catch any exception from there it just stucks at connect and my service terminates in the middle.
0 -
Can it be related to blocking connect call?
Yeah, possibly? I don't know enough about CSCSMP, but API should be handling this for you. Same with reconnects. Will be hard to diagnose w/out some code to look at. Did you verify same behaviour as shutting down the client username on the broker?
Speaking of blocking calls: keep in mind that both .NET and C are entirely one-threaded, so you cannot make any blocking calls in the API Context thread, otherwise it'll cause all sorts of havoc (e.g. internal API timers not getting serviced). I saw one user trying to do a database POST in the (API thread) "onMessage" callback, and 99% of the time it worked ok b/c the rates were low and database returned quickly, but if database blocks for any reason, then when finally returns the API disconnects itself and starts reconnection b/c enough watchdog timers were missed.
TL/DR: don't block in any API thread!
0