I am learning about XMPP for a project.
Lets say I have 2 or more instances of XMPP running behind NLB. And client 1 is connected to one instance and internal client (client 2) wants to send message to client 1.
Client 1 <----> XMPP servers <---> Client 2
How will the communication between these instances would be done? How can we identify with which host client 2 should interact so the message gets delivered to client 1? Or is there any other way already supported by XMPP?
I see hazelcast (https://hazelcast.com/products/in-memory-computing/) supports this. Can someone please elaborate how hazelcast support? And looking for more alternatives/ways to do it.
Please assist.
The details of this are defined in detail in the XMPP specifications. The short (and not totally accurate but good enough) summary follows.
Whenever an end-user logs in using an XMPP client, it gets a unique address (a "jabber identifier", or JID). Interaction using XMPP makes use of data fragments called 'stanzas' (which are XML-based). Stanzas have a 'from' and 'to' address, which uses these JIDs.
Whenever a client wants to send something to another client, it generates a stanza, and sets the 'to' address to the JID of the intended recipient. It then sends the stanza to the XMPP server that it is logged into. That server will determine if the intended recipient is connected to the same server, in which case the stanza is delivered immediately. If it is not, then the local server will establish a server-to-server connection to the server that is identified by the JID of the intended recipient. That server will then receive the stanza, and will forward it to the client of the intended recipient.
Conceptually, this is not much different from how emails are being send.
None of this is specific to Openfire, which is one (of many) XMPP server implementations. It is not specific to Hazelcast either (which is used as a third-party library in Openfire, but does not relate to XMPP directly at all).