I am working on reading large MQ messages in Java and processing + writing the contents of MQ message to a file.
The code I am writing is multi-threaded and can process multiple messages in parallel.
The writing application writes (PUT) large MQ message to the queue using Segmentation+Grouping.
Now, while reading below steps take place.
1.Set appropriate values for MQGetMessageOptions.
2. Initializing MQQueue - serverFileQueue and MQMessage - reqMessage.
3. Invoking get method for MQQueue by passing reqMessage and getGroupMsgOptions.
4. Checking the MQ message flags in a while loop to identify last segment of last message in group.
5. Write the message contents to a file using .
My question is, if the MQ message is too large, should the code be getting java.lang.OutOfMemoryError.
I am trying to understand if step 3 . would load entire MQ Message in memory? OR only segments would be loaded hence no need to worry about java.lang.OutOfMemoryError.
Answer to a) would be, sleep is being called on the Thread to avoid repetitive calls to get the prices. You put a and the current thread execution will be halted for 5 seconds. During this time the scheduler may choose any thread for execution according to the type/protocol of the scheduler.