Multiple clients with same JID

Is there any way to have multiple clients with the same ID connected simultaneously so that requests are sent out in either a round-robin fashion or, better yet, in a somewhat coherent fashion with respect to who is sending the message?

Specifcally, I want to run a back-end service. My service will connect to Jive Messagener just like any other client. People can then send messages to my service’‘s JID. My back-end service receives the messages, processes them, and sends a reply. The problem is, what happens if my server doesn’‘t scale (it’‘s processor intensive)? I’'d like to be able to connect multiple instances of my backend system and have Jive choose one to route it to. Choosing randomly would be ok, but trying to always assign the same user to the same server would make it easy to cache data.

I suspect the answer is no, but I figured I’‘d ask. If I ever get around to implementing it myself (which I may), I’‘d be glad to contribute it back, but since I don’'t know much about Jive, please also consider this a feature req.

Thanks,

Dan

The xmpp protocol specifies that you can connect with the same jid several times. The server decides then who has the highest priority for delivering messages. For sending the message he uses the ressource identifier like name@server/resource to deliver the message. you can change the priority with sending:

positive number

packages. Due to a possible bug http://www.jivesoftware.org/forums/thread.jspa?threadID=13542&tstart=0 it’'s not yet working as specified.

guido

Message was edited by:

guido

Hey guys,

The problem has already been identified and is being fixed. I’‘ll try to include a fix for tomorrow’'s daily build.

Thanks for your patience and for reporting the bug.

– Gato

Message was edited by:

dombiak_gaston

Thank you. I’'m actually asking about a slightly different use case:

I’'d like to connect two clients with the same JID and priority and have the messages split between them rather than sent to the one with the higher priority (or the most recent one with that priority).

Thanks,

Dan

Dan,

Currently Messenger will send the message only to the client that last logged in. We are planning to add better support for this situation in future versions.

You will be able to configure your installation and decide which logic to use. Available logic options could be:

  1. Deliver the message to the client with most recent connect time

  2. Deliver the message to the client with most recent activity time

  3. Deliver the message to the client with highest availability as determined by some hierarchy of values

  4. Deliver the message to all the resources with same priority.

Regards,

– Gato

Dan,

Currently Messenger will send the message only to the

client that last logged in. We are planning to add

better support for this situation in future versions.

You will be able to configure your installation and

decide which logic to use. Available logic options

could be:

  1. Deliver the message to the client with most recent

connect time

  1. Deliver the message to the client with most recent

activity time

  1. Deliver the message to the client with highest

availability as determined by some hierarchy of

values

  1. Deliver the message to all the resources with same

priority.

Regards,

– Gato

Just wondering about the part where we can “configure your installation and decide which logic to use”… where can i find this feature?

Thanks!

Hey,

This enhancement has not been implemented yet. It is planned for 2.2.0 which is a little away for now. FYI, the issue for this enhancement is JM-14.

Thanks,

– Gato

I see. So how does the Messenger manage routing messages between two resources right now? By priority right? If so, how do I set which resource has higher priority?

Btw, I’'m using a test client with smack and the other with Exodus.

Thanks again.

Regards,

Dustin

Hey Dustin,

In Exodus you will need to click on Details button (in the Login window) and then click on the Connection tab.

Currently Smack does not provide a direct API for setting the priority. However, you can do something like this:

connection.sendPacket(new Presence(Presence.Type.AVAILABLE, null, 1,
                    Presence.Mode.AVAILABLE));

where the number parameter is the priority.

Regards,

– Gato