Hey Pyp. I’d consider looking at the correlating publish handler: JCSMPStreamingPublishCorrelatingEventHandler (Solace Messaging API for Java v10.25.2). It’s easier to use. You just need to set the correlation key on each message sent (could even be itself), and that way it’s a lot easier to correlate, rather than using than using the MessageID.
But FYI, the order that messages are ACKed or NACKed are exactly the same as the order you publish, so you can also just keep your sent messages in a LinkedList until the ACK (responseReceived) or NACK (handleError) arrives.