Within an IQ Handler I’‘m developing, there’‘s a need to send another packet to a few users, apart from the standard reply packet returned to the IQ origin. There could be up to 9-10 packets I need to send to different JID’'s before returnig the reply packet.
So far I was using the following steps to send those extra packets:
That is the exact code you have to use. When creating new packets and sending them you should use a router to route them. The router will invoke the corresponding packet interceptors and route the packet accordingly. If you instead try to find the target session by yourself and send the packet then you will be skipping some required logic unless you have some good reason for doing that which is not recommended.
I think using the current thread is fine. Delivering packets to clients is done by another thread. So your current thread will just queue the packet for delivery and MINA will do the actual delivery for you. In other words, delivery of packets is asynchronous.