Hello,
[Background]
- We have a REST API created in Java which sends a Message to XMPP Server(ejabberd) using Smack.
- Previously, we were using XMPPConnection(Smack v3.2.2) to connect to Xmpp Server and Send a Message to XMPP(ejabberd) using the created connection. For LoadBalancing on EC2 servers we were using AWS CLB(for TCP Connection).
[Current Situation]
- We have recently updated the Smack library to v4.4.8.
- Also, since we need to migrate our application to use AWS ALB(for Https Connection), we have used XmppBoshConnection to communicate with XMPP(ejabberd) because ALB doesn’t support TCP Connections.
[Problem is occurring when using XmppBoshConnection]
- When using XmppBoshConnection, it takes a long time to connect to XMPP(ejabberd) as compared to XmppTCPConnection.
- Sometimes, the trySendStanza() method takes more than 30 seconds to complete. (As much as I have checked, the trySendStanza() method is asynchronous and doesn’t wait for the message to be sent successfully).
- Also, sometimes the trySendStanza() request is getting blocked forever and the application gets stuck.
- I understand that the XmppBoshConnection is slower as compared to XmppTCPConnection(as read in the community questions) due to Http overhead.
- But, why is trySendStanza() taking such a long time?
[No issue when using XmppTCPConnection]
- I tried the same situation with XmppTCPConnection. When using XmppTCPConnection, the trySendStanza() is being completed within 2 seconds.
Can someone please help me out with a solution that works efficiently when using XmppBoshConnection?