AnsweredAssumed Answered

Smack threads and Android threads

Question asked by Agustín Alcázar on Sep 11, 2017

Hi there!

 

I'm newbie in this forum, but I've developed a XMPP Smack Android application and I've got some questions about smack behaviour and threads. Here I go:

I get from roster my contacts with their JID, and with these, I send a MAM stanza to get history, like that:

 

<iq type='get' id='downloadMessages'>
<query
xmlns='urn:xmpp:mam:tmp'>
<with>user@myserver.com</with>
<set
xmlns='http://jabber.org/protocol/rsm'>
<max>30</max>
<before/>
</set>
</query>
</iq>

 

With this, I receive on my StanzaListener every messages from this JID, what is ok, but it looks like if each message (stanza received) was in an new thread, so I can't sort messages in arrive order. So, my question is as follows:

 

- Is there any way to receive all MAM messages stanzas in order (within same thread) for every jid and every message within its jid?

 

Following this topic, I'd like to know if I can create many StanzaListener to group different kinds of calls. If I could, it will be cool to implements RxJava and add listeners to listen only determitates packets, and remove them when my operations have finished. Actually, I only have one StanzaListener (called MyPacketInterceptor) which is listening for every packets.

 

Thanks in advance!

Outcomes