Any solution that uses non-volatile storage to hold the "count" of messages
processed is going to fail when the server with that storage crashes unless you
are clever about how you design the protocol.
e.g. you could collate the responses by sending jms responses to a client
that is designed for the purpose. e.g. uses CLIENT_ACK to wait for all
reponses in a group (defined in the message properties) before considering the work done
and then doing whatever is required.