Author |
Message
|
hllam |
Posted: Wed Jun 28, 2006 10:57 pm Post subject: JMS Pub-Sub Problem |
|
|
Newbie
Joined: 28 Jun 2006 Posts: 2
|
We are now using MQSeries v5.3 + SupportPac MQ_CSD08
We try to integrade MQ by JMS, However, in JMS specification, it assumed that referencing objects should be created by underlaying MOM server( which is MQSeries in our case).
For the P2P communication, we can create the physical Queue in MQ, by invoke runmqsc using JAVA Runtime class.
i.e.
echo DEFINE QLOCAL('Queue') REPLACE DEFPSIST(YET) SHARE | c:\Progra~1\IBM\WebSph~2\bin\runmqsc QM_RAE
And we can define MQ object name in JNDI by JMSAdmin.exe <---- It seems only define a namespace but not a physical object.
However, for the Pub-Sub communication mode, we can't find the way to create a Topic.
In MQ, it does not have a physical "Topic" object. It seems a pub-sub broker is used to simulate a Topic connection with a Queue object.
So we want to know how to config and link the logical "Topic" with a physical "Queue".
To config the Pub-Sub in MQ :
First, we have setup a QManager "QM_RAE" and created all the required system queue using the startup script :
i.e.
\bin\runmqsc QM_RAE < MQJMS_PSQ.mqsc
and then linked it with a topic broker,
i.e.
strmqbrk -m QM_RAE
We can run the predefined verification script without error
i.e.
psivtrun -nojndi -m QM_RAE
But when we try to dynamic create Topic in programming level, we got the JMSException, saying that underlaying queue is not
created or not available :
javax.jms.JMSException: MQJMS2008: failed to open MQ queue
at com.ibm.mq.jms.services.ConfigEnvironment.newException(ConfigEnvironment.java:530)
at com.ibm.mq.jms.MQTopicSession.createPublisher(MQTopicSession.java:898)
at TestMQ_PS.<init>(TestMQ_PS.java:58)
at TestMQ_PS.main(TestMQ_PS.java:171)
the corresponding linked Exception in MQ is :
com.ibm.mq.MQException: MQJE001: Completion Code 2, Reason 2085
at com.ibm.mq.MQQueueManager.accessQueue(MQQueueManager.java:1391)
at com.ibm.mq.jms.MQTopicSession.createPublisher(MQTopicSession.java:893)
at TestMQ_PS.<init>(TestMQ_PS.java:58)
at TestMQ_PS.main(TestMQ_PS.java:171)
The meaning of reason code 2085 is :
2085 0x00000825 MQRC_UNKNOWN_OBJECT_NAME
The code we used for testing, is the standard MQ JMS sample code :
factory = new MQTopicConnectionFactory();
factory.setHostName(hostname);
factory.setPort(port);
factory.setQueueManager(qMgrName);
factory.setBrokerQueueManager(qMgrName);
factory.setBrokerControlQueue("BROKER.CONTROL.QUEUE");
factory.setBrokerPubQueue("BROKER.DEFAULT.STREAM");
// createQueue(QUEUE);
topicConnection = factory.createTopicConnection();
topicConnection.start();
topicSession = topicConnection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
Topic topic = topicSession.createTopic("topic://NEWSTOPIC1?brokerVersion=1");
TopicPublisher publisher = topicSession.createPublisher(topic);
TopicSubscriber subscriber = topicSession.createSubscriber(topic);
TextMessage message = topicSession.createTextMessage();
message.setText("Hello subscribers..");
publisher.publish(message);
TextMessage inMessage = (TextMessage)subscriber.receive();
System.out.println(inMessage.getText());
publisher.close();
subscriber.close();
topicSession.close();
pubSession.close();
topicConnection.close(); |
|
Back to top |
|
 |
fjb_saper |
Posted: Tue Jul 04, 2006 9:47 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
Quote: |
factory.setBrokerControlQueue("BROKER.CONTROL.QUEUE");
factory.setBrokerPubQueue("BROKER.DEFAULT.STREAM"); |
I believe here you want to use "SYSTEM.BROKER.CONTROL.QUEUE" AND "SYSTEM.BROKER.DEFAULT.STREAM".
These should be the queues you defined running the broker script before starting the broker.
Enjoy  _________________ MQ & Broker admin |
|
Back to top |
|
 |
mvic |
Posted: Tue Jul 04, 2006 12:09 pm Post subject: |
|
|
 Jedi
Joined: 09 Mar 2004 Posts: 2080
|
fjb_saper wrote: |
Quote: |
factory.setBrokerControlQueue("BROKER.CONTROL.QUEUE");
factory.setBrokerPubQueue("BROKER.DEFAULT.STREAM"); |
I believe here you want to use "SYSTEM.BROKER.CONTROL.QUEUE" AND "SYSTEM.BROKER.DEFAULT.STREAM".
These should be the queues you defined running the broker script before starting the broker.
Enjoy  |
I think it should be possible to run this program without any explicit settings for broker control queue and broker publish queue. That is, omit the 2 lines quoted above. The defaults should be as fjb_saper listed them - no need to override the defaults with the same values they would have defaulted to.  |
|
Back to top |
|
 |
hllam |
Posted: Tue Jul 04, 2006 5:25 pm Post subject: |
|
|
Newbie
Joined: 28 Jun 2006 Posts: 2
|
factory.setBrokerControlQueue("BROKER.CONTROL.QUEUE");
factory.setBrokerPubQueue("BROKER.DEFAULT.STREAM");
I can run my code by omitting the above 2 lines.
Thanks a lot ~ ~
 |
|
Back to top |
|
 |
8davitt |
Posted: Wed Jul 05, 2006 5:37 am Post subject: |
|
|
Apprentice
Joined: 06 Feb 2003 Posts: 37 Location: Seated in front of monitor
|
Quote: |
We are now using MQSeries v5.3 + SupportPac MQ_CSD08 |
Why on earth would you be using CSD08 level when it is known to be unstable and has been withdrawn by IBM from their download websites?
You should apply the latest service level FP12 (CSD12) as soon as possible before you hit any of the many problems that have been resolved since CSD08/CSD09.
/s |
|
Back to top |
|
 |
Vitor |
Posted: Wed Jul 05, 2006 5:45 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
8davitt wrote: |
Why on earth would you be using CSD08 level when it is known to be unstable and has been withdrawn by IBM from their download websites?
You should apply the latest service level FP12 (CSD12) as soon as possible before you hit any of the many problems that have been resolved since CSD08/CSD09.
|
For completeness, and to emphasise the point if it needed more emphasis:
http://www.mqseries.net/phpBB2/viewtopic.php?t=24683 _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
Philip Yuen |
Posted: Wed Jul 05, 2006 5:36 pm Post subject: |
|
|
Newbie
Joined: 05 Jul 2006 Posts: 1
|
Hi,
I'm the colleague of hllam. I am the one who passed MQSeries 5.3 and CSD8 to him.
We are newbies in MQSeries. We start learning and writing using MQSeries recently coz we are developing applications to integrate with IBM Premises Server v1.0.2, which uses MQSeries 5.3 with CSD8. I have had a quick check on v.1.1 installation disks and it is also using CSD8. We are quite stuck with CSD8 coz we have no idea if Premises Server can work on other versions of MQSeries.
Please help.
Philip |
|
Back to top |
|
 |
fjb_saper |
Posted: Wed Jul 05, 2006 7:55 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
Phillip,
If you stick to the same version as the server in the jar files the problems should be minimized. The greatest problems in the CSDs (8,9,10) are really if you have a client that uses a different CSD than the one on the server.
Enjoy  _________________ MQ & Broker admin |
|
Back to top |
|
 |
|