|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
Open Input exclusive option (MQC.MQOO_INPUT_EXCLUSIVE ) |
« View previous topic :: View next topic » |
Author |
Message
|
ksrjo24 |
Posted: Mon Sep 20, 2010 12:16 pm Post subject: Open Input exclusive option (MQC.MQOO_INPUT_EXCLUSIVE ) |
|
|
Newbie
Joined: 15 Sep 2010 Posts: 4
|
Hi,
Here is a sample program that i am trying to test the exclusive Queue Access using MQ JMS.
MQQueueConnectionFactory cf = new MQQueueConnectionFactory();
// Config
cf.setHostName("myhost");
cf.setPort(1414);
cf.setTransportType(1);
cf.setQueueManager("MyQueueManager");
cf.setChannel("Mychannel");
MQQueueConnection connection = (MQQueueConnection) cf.createQueueConnection();
MQQueueSession session = (MQQueueSession) connection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
MQQueue queue = (MQQueue) session.createQueue("queue:///myqueue");
//MQQueue queue = (MQQueue) session.createQueue("queue:///myqueue");
MQQueueSender sender = (MQQueueSender) session.createSender(queue);
MQQueueReceiver receiver = (MQQueueReceiver) session.createReceiver(queue);
long uniqueNumber = System.currentTimeMillis() % 1000;
JMSTextMessage message = (JMSTextMessage) session.createTextMessage("SimplePTP "+ uniqueNumber);
connection.start();
//sender.send(message);
System.out.println("Sent message:\\n" + message);
Message receivedMessage = (Message) receiver.receive(1000);
if (receivedMessage instanceof TextMessage) {
String replyString = ((TextMessage) receivedMessage).getText();
System.out.println(replyString);
} else {
// Print error message if Message was not a TextMessage.
System.out.println("Reply message was not a TextMessage");
}
//System.out.println("\\nReceived message:\\n" + receivedMessage);
sender.close();
receiver.close();
session.close();
connection.close();
System.out.println("\\nSUCCESS\\n");
What i need is for this connection go be equivalent to the IBM Native option of MQOO_INPUT_EXCLUSIVE and MQQA_SHAREABLE = FALSE
Basically I want the connection to get an exclusive access to the queue.
I can modify the
MQQueue queue = (MQQueue) session.createQueue("queue:///myqueue");
with soem key value pairs. something like
MQQueue queue = (MQQueue) session.createQueue("queue:///myqueue?persistence=1&priority=5")
or I could use the setProperty method of the MQQueue
queue.setPersistence(DeliveryMode.NON_PERSISTENT);
queue.setPriority(5);
From the documentation, these are the only properties that I can use are
expiry,priority,persistence,CCSID,targetClienet,encoding.
My question is what property do I set to get the equivalent of Exclusive write access to the queue??
Thanks
Last edited by ksrjo24 on Thu Sep 23, 2010 7:29 am; edited 2 times in total |
|
Back to top |
|
 |
Vitor |
Posted: Mon Sep 20, 2010 12:21 pm Post subject: Re: Open Input exclusive option (MQC.MQOO_INPUT_EXCLUSIVE ) |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
This is inconsistent:
ksrjo24 wrote: |
What i need is for this connection go be equivalent to the IBM Native option of MQOO_INPUT_EXCLUSIVE |
ksrjo24 wrote: |
My question is what property do I set to get the equivalent of Exclusive write access to the queue?? |
The MQOO_INPUT_EXCLUSIVE offers exclusive read access not write (put) access.
If you mean read access I'll leave wiser minds than mine to answer you. If you're in fact looking for the equivalent of MQOO_OUTPUT_EXCLUSIVE you're out of luck.
I'll also rap you gently over the knuckles for a near double post of this _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
ksrjo24 |
Posted: Mon Sep 20, 2010 2:45 pm Post subject: Re: Open Input exclusive option (MQC.MQOO_INPUT_EXCLUSIVE ) |
|
|
Newbie
Joined: 15 Sep 2010 Posts: 4
|
Sorry my bad. Yes, the goal is for a single process to read the queue.
If another process tries to read from the queue then we would like to see an exception thrown by the Queue Manager. That is the exact configuration that we are looking for. |
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|
|