|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
How to set MQRC option via JMS API |
« View previous topic :: View next topic » |
Author |
Message
|
prabuk |
Posted: Fri Mar 05, 2004 1:06 pm Post subject: How to set MQRC option via JMS API |
|
|
 Novice
Joined: 14 Mar 2003 Posts: 19 Location: JerseyCity, NJ
|
I'm writing code in JMS API to do a request reply app. I have exp in MQ Base. Our project doesn't require JNDI naming, we are asked to not to use, hence I'm trying to create QCF and Q at runtime. Please see the attached code,
Quote: |
factory = new MQQueueConnectionFactory();
factory.setTransportType(JMSC.MQJMS_TP_CLIENT_MQ_TCPIP);
factory.setQueueManager(queueManagerName);
factory.setHostName(hostIP);
factory.setChannel(channel);
factory.setPort(port);
connection = factory.createQueueConnection();
connection.start();
boolean transacted = false;
session = connection.createQueueSession( transacted,
Session.AUTO_ACKNOWLEDGE);
reqQueue = session.createQueue(requestQueueName);
srvQueue = session.createQueue(serverQueueName);
System.out.println("Trying to open queue..." + reqQueue.getQueueName());
qReceiver = session.createReceiver(reqQueue);
dest = (Destination)(qReceiver.getQueue()); |
MQ throws 2045 (MQRC_OPTION_NOT_VALID_FOR_TYPE) at line where we do session.createReceiver.
In MQ Base java, we used to have control over setting required MQC option before accessing the queue,
Quote: |
mqMgr = new MQQueueManager(queueManagerName);
System.out.println("Got Handle to MQ Manager.");
// mqOptions = MQC.MQOO_INPUT_AS_Q_DEF | MQC.MQOO_OUTPUT;
mqOptions = MQC.MQOO_OUTPUT;
mqQueue = mqMgr.accessQueue(queueName, mqOptions); |
Please answer my questions,
1. Is there any mistake in my JMS code? Why am I getting 2045
2. How could we set out MQC options in JMS as we do in MQ Base Java?
Thanks for your help |
|
Back to top |
|
 |
prabuk |
Posted: Mon Mar 08, 2004 6:40 am Post subject: |
|
|
 Novice
Joined: 14 Mar 2003 Posts: 19 Location: JerseyCity, NJ
|
Hi folks,
No body ever tried to create QCF and Q at runtime and got this error. Or anybody knows how to set the QRC options directly in JMS API. I went through all avail docs, nowhere it is mentioned. Help is much appreciated.
Thanks in advance |
|
Back to top |
|
 |
EddieA |
Posted: Mon Mar 08, 2004 7:26 am Post subject: |
|
|
 Jedi
Joined: 28 Jun 2001 Posts: 2453 Location: Los Angeles
|
What kind of Queue is this. Local, Remote, Clustered.
In your Java example, you use:
Quote: |
mqOptions = MQC.MQOO_OUTPUT; |
But your JMS tries to create an Receiver:
Quote: |
qReceiver = session.createReceiver(reqQueue); |
Unless the Queue is local to you, you can't read it.
Cheers, _________________ Eddie Atherton
IBM Certified Solution Developer - WebSphere Message Broker V6.1
IBM Certified Solution Developer - WebSphere Message Broker V7.0 |
|
Back to top |
|
 |
prabuk |
Posted: Mon Mar 08, 2004 8:05 am Post subject: |
|
|
 Novice
Joined: 14 Mar 2003 Posts: 19 Location: JerseyCity, NJ
|
It is a local queue that I want to read from. Fragment of code that I have shown is from the requester (client) program, first I'm trying to create a receiver and then a sender..
Quote: |
factory = new MQQueueConnectionFactory();
factory.setTransportType(JMSC.MQJMS_TP_CLIENT_MQ_TCPIP);
factory.setQueueManager(queueManagerName);
factory.setHostName(hostIP);
factory.setChannel(channel);
factory.setPort(port);
connection = factory.createQueueConnection();
connection.start();
boolean transacted = false;
session = connection.createQueueSession( transacted,
Session.AUTO_ACKNOWLEDGE);
reqQueue = session.createQueue(requestQueueName);
srvQueue = session.createQueue(serverQueueName);
System.out.println("Trying to open queue..." + reqQueue.getQueueName());
qReceiver = session.createReceiver(reqQueue);
dest = (Destination)(qReceiver.getQueue());
outMessage.setJMSReplyTo(dest);
QueueSender qSender = session.createSender(srvQueue);
qSender.send(outMessage);
msg = qReceiver.receive(responseWaitTime); |
|
|
Back to top |
|
 |
prabuk |
Posted: Mon Mar 08, 2004 8:14 am Post subject: |
|
|
 Novice
Joined: 14 Mar 2003 Posts: 19 Location: JerseyCity, NJ
|
Eddie
Sorry, It was my mistake. I was confused between req annd response queues. You are right that I was trying to write onto a remote queue, that was my naming problem. It works fine now.
Thanks |
|
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
|
|
|
|