I am implementing QOS in tigase to ensure delivery of messages.Below are listed my QOS steps
- Caching every message packet ( except composing, typing, stopped etc) in a sorted order of timestamp
- On receiving delivery notification of packet i delete it from cache
- After regular intervals a thread is launched to check packets which are still present in cache with time window
- If thread found any packet in that time window ( it means that message is not delivered) so thread need to send it again
My question is how can i send packet again sitting inside that thread.
- Can i try addOutPacket from thread ( it's not working right now )
- Should i implement my QOS in component so that it can easily do addOutPacket
- Or is there any better way to achieve this
Your suggestions are highly thankful
EDIT:
Some clarifications:
- We will not save messages in cache indefinitely
- We will retry every message at most 3 times after which we will save the un-acknowledged packet in the Offline Storage
- If XEP-0198 is enabled in Tigase by default which I assume it is, we still experience message loss when the connection between server and client is lost (irrecoverable failure). If the network layer takes time to detect an irrecoverable failure, the messages sent to that connection are permanently lost. In case of EDGE or a shaky internet connection, we face this consistently seriously hurting user experience.