🎄 Happy Holidays! 🥳

Most of Solace is closed December 24–January 1 so our employees can spend time with their families. We will re-open Thursday, January 2, 2024. Please expect slower response times during this period and open a support ticket for anything needing immediate assistance.

Happy Holidays!

Please note: most of Solace is closed December 25–January 2, and will re-open Tuesday, January 3, 2023.

Solace Failover

Bhumika
Bhumika Member Posts: 5

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

  • TomF
    TomF Member, Employee Posts: 412 Solace Employee

    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.

  • Bhumika
    Bhumika Member Posts: 5

    Thank You @TomF it was helpful, worked fine.

  • Aaron
    Aaron Member, Administrator, Moderator, Employee Posts: 644 admin

    Hi @Bhumika! Out of curiosity, what is your use case? What are you trying to achieve, or know... and why? Thanks.

  • Bhumika
    Bhumika Member Posts: 5

    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
             }
    

    }

  • TomF
    TomF Member, Employee Posts: 412 Solace Employee

    @Bhumika I don't think so - I think it returns the virtual router name, rather than the host ip or name. I suppose the next question is: what do you need this information for? What are you going to do with it?

  • Bhumika
    Bhumika Member Posts: 5


    I just want to know which server my message went to.No operation I need to perform on it.

  • TomF
    TomF Member, Employee Posts: 412 Solace Employee

    OK, so does extracting the host name from the log do what you want? Just trying to make sure you have what you need.