Reputation: 1871
I am using IBM MQ API to connect to the queue to load my messages from a file. I use javax.jms.QueueSender
to load the messages to my queue 'TEST.IBM.Q'.
I have a functionality to load the number of valid messages from a file to be loaded as the first message.
Example: Say I have a file called File1.txt:
Valid
Valid
Valid
Invalid
Valid
Here, I will load 5 messages to my queue like below,
Count-4
Valid
Valid
Valid
Valid
Currently, I am iterating throughout the file to find the number of valid messages and loading it in the start & iterating again to load the messages.
I know, its a bad way of doing it. Some one could you please let me know, Is there any possibility to load a message in the start of the queue once everything is done?
Thanks in advance to everyone!!
Upvotes: 0
Views: 149
Reputation: 15273
By default, in IBM MQ, messages are delivered on a priority basis, higher priority messages are delivered first followed by lower priority messages.
You can make use of this feature. Set different priorities for valid and invalid messages. If you want the valid messages to be delivered first, then set a higher priority for valid messages and lower priority to invalid messages.
Upvotes: 2