// Pull messages until not busy
while (session.isBusy()) {
// NOTE: this should work for queues because they require a
// resume flow from the client
Packet emptyPacket = new Packet();
session.fillNextPacket(emptyPacket);
// write packet
writePacket(emptyPacket, false);
}
}