Solace Failover
I am using solace topic to send my message and session property in host has multiple comma separated ips (ip1:port1,ip2:port2).So in case of failover how do I know which IP I have connected to,i.e. which IP my message is sent to ?
Answers
-
Hi @Bhumika, probably the easiest way is to look in the Solace API logs. For instance, at INFO level in JCSMP with my log4j.properties (level INFO) I see:
Connecting to host 'orig=192.168.32.150, host=192.168.32.150' (host 1 of 1, smfclient 2, attempt 1 of 1, this_host_attempt: 1 of 1)
You'll also get a session event during the connection process that you can look at. This will tell you when the connection is interrupted, when the reconnection is occurring, etc. In JCSMP these are enumerated in SessionEvent, and you can use SessionEvent.getInfo() to get the details.
You can, of course, also query the broker. Go to the clients tab in PubSub+ Manager - if there are none, this is probably the broker that failed over. You should see your client in the other broker's client list.1 -
hi @TomF ,I am using C# .NET and used SessionEventargs.info to get the host connected to before calling the session.connect..So would it be correct to know which host i am connected to?
private void HandleSessionEvent(object sender, SessionEventArgs e)
{
try
{// msg = String.Format("Session Event Received: '{0}' Type: '{1}' Text: '{2}' CorrelationTag: '{3}'", e.Event, e.ResponseCode.ToString(), e.Info, e.CorrelationKey) // MessageBox.Show(msg) //Added by Bhumika J on 27-Apr-2020||To capture host connected to in case of failover||START string msg; ** msg = e.Info;** oLogger.LogInformationMessage("Successfully Connected to :" + msg); //Added by Bhumika J on 27-Apr-2020||To capture host connected to in case of failover||END }
}
0