PriorityQueueing for MDB

Joined
May 14, 2012
Messages
1
Reaction score
0
Hi

Can any one help out how to handle Priority Queuing in JMS using MDB. I have used below code in client side

QueueSender sender = session.createSender(queue);
ObjectMessage objectMsg = session.createObjectMessage();
for (int i = 1; i <= 5; i++) {
if (i == 1) {
sender.setPriority(2);
objectMsg.setObject(" Client Quiue value=" + 2);
//objectMsg.setJMSPriority(2);
//producer.send(objectMsg, DeliveryMode.PERSISTENT, 2, 10000);
}
if (i == 2) {
sender.setPriority(1);
objectMsg.setObject(" Client Quiue value=" + 1);
//objectMsg.setJMSPriority(1);
//producer.send(objectMsg, DeliveryMode.PERSISTENT, 1, 10000);
}
if (i == 3) {
sender.setPriority(7);
objectMsg.setObject(" Client Quiue value=" + 7);
//objectMsg.setJMSPriority(7);
//producer.send(objectMsg, DeliveryMode.PERSISTENT, 7, 10000);
}
if (i == 4) {
sender.setPriority(3);
objectMsg.setObject(" Client Quiue value=" + 3);
//objectMsg.setJMSPriority(3);
//producer.send(objectMsg, DeliveryMode.PERSISTENT, 3, 10000);
}
if (i == 5) {
sender.setPriority(6);
objectMsg.setObject(" Client Quiue value=" + 6);
//objectMsg.setJMSPriority(6);
//producer.send(objectMsg, DeliveryMode.PERSISTENT, 6, 10000);
}
System.out.println("JMS Message Send To MOM = "+sender.getPriority());
sender.send(objectMsg);
}


Even though it's not working because once we populate message into queue it will control by apps server.

Is there any alternative way to handle which will make 100 % sure priority queue.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,228
Members
46,818
Latest member
SapanaCarpetStudio

Latest Threads

Top