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 » How to set MQRC option via JMS API

Post new topic  Reply to topic
 How to set MQRC option via JMS API « View previous topic :: View next topic » 
Author Message
prabuk
PostPosted: Fri Mar 05, 2004 1:06 pm    Post subject: How to set MQRC option via JMS API Reply with quote

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
View user's profile Send private message
prabuk
PostPosted: Mon Mar 08, 2004 6:40 am    Post subject: Reply with quote

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
View user's profile Send private message
EddieA
PostPosted: Mon Mar 08, 2004 7:26 am    Post subject: Reply with quote

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
View user's profile Send private message
prabuk
PostPosted: Mon Mar 08, 2004 8:05 am    Post subject: Reply with quote

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
View user's profile Send private message
prabuk
PostPosted: Mon Mar 08, 2004 8:14 am    Post subject: Reply with quote

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
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 » How to set MQRC option via JMS API
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.