XMLMessageProducer
Hello, does anyone knows how to use XMLMessageProducer with JCSMPStreamingPublishEventHandler?
I tested sample code according to example on this page: https://docs.solace.com/API-Developer-Online-Ref-Documentation/java/com/solacesystems/jcsmp/XMLMessageProducer.html.
Event responseReceived is returning message id different to sent message id. For example, sent message id has value 10 and received has 11 (almost greater by one). Is it expected behavior?
I am talking about version 10.6.3.
Thanks
Answers
-
Hey Pyp. I'd consider looking at the correlating publish handler: https://docs.solace.com/API-Developer-Online-Ref-Documentation/java/com/solacesystems/jcsmp/JCSMPStreamingPublishCorrelatingEventHandler.html. 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.
1