Check if smack send queue is empty

Hi,

I’'m using smack 2.0.0 to send packets to a Jive Messenger 2.2.0

The system send messages in bulk mode to another client. Is there a way to check if smack has sent all messages (the are first stored in smack’'s queue and then sent out by a seperate thread) so that I can close the Jabber connection after all messages have been sent out?

Thanks,

Torsten.

I’‘ve tried to install a PacketWriterListener to count the sent packets against the packets my application has sent but the Listener ist not called when the packet arrives at the server but probably when it is queued to be sent. This means if I close my application too early I’'m not able to send all messages!

Please help!

There’'s actually an issue filed about this: SMACK-10. That fix is probably the best approach and hopefully we can get it in in the near future.

Regards,

Matt

Thanks for the response.

My workaround for now is to create my own debugger instance that gets notifies when a string is sent to the server. I count this against the messages that must be sent out. It’'s not quiet correct since smack also sends presence messages but it helps for now.

Would I’'d like to have is kind of a 2 phase close.

First stage: no messages are accepted for sending and the server will not send new messages to smack, but the queues are processed until empty

Second stage: connection closed.

bye,

Torsten.