powered by Jive Software

ConnectionListener vs. Connection manager

Hi,

I am implementing the reconnection logic using Smack ConnectionListener. My connection listener works fine when the connection is built directly between my smack client and openFire XMPP server. However, the situation truns bad after I added two connection managers between my smack client and openFire XMPP server. Basically, my connection listener doesn’t work as we expect to. Here are all the cases that I am facing. Please share your experience if you know how to get around these cases.

Start up both connection managers and openFire XMPP server. The smack client go though connection manager 1, and connect to XMPP server.

1> Shutdown connection manager 1.

My connection listener won’t fail over to the connection manager 2, but still try to reconnect to connection manager 1. I am not sure if there is a way to force connection listener rebuilding the connection to the other connection manager (Round robin?).

2> Shutdown openFire XMPP server, but leave all connection manages alive.

My connection listener detects the XMPP server is down, but rebuild the connection to the connection manager 1 after 10 seconds. This causes my client application reports a wrong status of XMPP server, and the connection listener wouldn’t be triggered again even after restarting the openFire XMPP server. Basically, I lost the timing to reconnect to the real XMPP server. Is there a way that I can force this connection listener run periodically regardless the connection status?

Sorry for this long question, but I am really stuck at here.

Thanks in advance.