MessageQueue.getMessages() is not returning anything for subsequent call.
This issue happens with newer version of JTOpen library. Older libraries (8.x) works fine.
eg, First Run
if (program.run()){
Enumeration en = queue.getMessages();
//en gets the messages from queue
}
Second run
if (program.run()){
Enumeration en = queue.getMessages();
//en doesn’t get messages from queue
}
Third run
if (program.run()){
Enumeration en = queue.getMessages();
//en gets the messages from queue
}
Does 8.7 or 8.6 work fine? we changed the class in 8.6.
This seems to be working fine till 9.1.
Observed issue in 9.4
I wrote a sample code to get a message queue messages. I can get the messages from the queue for every loops, it works with latest JTOpen. Is there any different from your program?
for (int i = 0; i < 3; i++) {
try {
Enumeration en = q.getMessages();
System.out.println("==== Enumeration loop " + i + " ====");
while (en.hasMoreElements()){
System.out.println(en.nextElement());
} catch (Exception e) {
}
}