ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » IBM MQ Java / JMS » Open Input exclusive option (MQC.MQOO_INPUT_EXCLUSIVE )

Post new topic  Reply to topic
 Open Input exclusive option (MQC.MQOO_INPUT_EXCLUSIVE ) « View previous topic :: View next topic » 
Author Message
ksrjo24
PostPosted: Mon Sep 20, 2010 12:16 pm    Post subject: Open Input exclusive option (MQC.MQOO_INPUT_EXCLUSIVE ) Reply with quote

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
View user's profile Send private message
Vitor
PostPosted: Mon Sep 20, 2010 12:21 pm    Post subject: Re: Open Input exclusive option (MQC.MQOO_INPUT_EXCLUSIVE ) Reply with quote

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
View user's profile Send private message
ksrjo24
PostPosted: Mon Sep 20, 2010 2:45 pm    Post subject: Re: Open Input exclusive option (MQC.MQOO_INPUT_EXCLUSIVE ) Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » IBM MQ Java / JMS » Open Input exclusive option (MQC.MQOO_INPUT_EXCLUSIVE )
Jump to:  



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
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.