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 » question on mqseries pub/sub

Post new topic  Reply to topic
 question on mqseries pub/sub « View previous topic :: View next topic » 
Author Message
Vin
PostPosted: Wed Aug 25, 2004 1:50 pm    Post subject: question on mqseries pub/sub Reply with quote

Master

Joined: 25 Mar 2002
Posts: 212
Location: India

just getting my hands dirty on MQSeries pub/sub. I tried running the sample program JMSPubSub with the publisher option and it went fine. When I tried to use the same program as a subscriber I'm getting the following message

Exception in thread "main" javax.jms.JMSException: MQJMS2008: failed to open MQ queue

In a pub/sub do I need to create a queue for the subscriber to register its subscription? I have the broker running on my machine and I'm using the MA0C support pac. Do I need to create a queue with the same name as the topic that I'm using for publishing the messages? appreciate your help
Back to top
View user's profile Send private message
bower5932
PostPosted: Thu Aug 26, 2004 5:23 am    Post subject: Reply with quote

Jedi Knight

Joined: 27 Aug 2001
Posts: 3023
Location: Dallas, TX, USA

There is a mqjms_psq.mqsc file in the java\bin subdirectory that needs to be run to set up JMS queue definitions.
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger
bower5932
PostPosted: Thu Aug 26, 2004 5:30 am    Post subject: Reply with quote

Jedi Knight

Joined: 27 Aug 2001
Posts: 3023
Location: Dallas, TX, USA

I just tried the JMSPubSub and it worked for me. I had already created my JMS definitions via the mqsc file, so that is probably your error.

Also, if you are just starting out with publish/subscribe, there are also a couple of samples at:

http://www.developer.ibm.com/tech/sampmq.html

You can look for mqjmspub.java and mqjmssub.java. They also have a link in the prologue to instructions on how to run them.
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger
Vin
PostPosted: Thu Aug 26, 2004 9:52 am    Post subject: Reply with quote

Master

Joined: 25 Mar 2002
Posts: 212
Location: India

Thanks for the reply guys but the problem is like this.

I'm able to run the JMSPubSub if the broker is running on the local queue manager and I want to publish and subscribe to a certain topic, but if the queuemanager itself is remote and I have a client connection to it using JMS, I"m able to publish the message fine but while subscribing to it I get the message "Failed to open MQQueue".

My question is if the queuemanager is remote how do I subscribe to the topic? do I have to define any channels from the MQ side?
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Thu Aug 26, 2004 9:54 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

Vin wrote:
but while subscribing to it I get the message "Failed to open MQQueue".

What is the reason code/linked exception?
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
bower5932
PostPosted: Thu Aug 26, 2004 10:05 am    Post subject: Reply with quote

Jedi Knight

Joined: 27 Aug 2001
Posts: 3023
Location: Dallas, TX, USA

I just re-ran it with a client connection, and it works fine. Modify the code to catch the linked exception:
Code:

   } catch( JMSException je ) {
      System.out.println("JMS Exception: " + je);
      // check for a linked exception
      Exception le = je.getLinkedException();
      if (le != null) {
         System.out.println("Linked exception: " + le);
      }
  }
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger
Vin
PostPosted: Thu Aug 26, 2004 3:05 pm    Post subject: Reply with quote

Master

Joined: 25 Mar 2002
Posts: 212
Location: India

Here is the linked exception

Linked Exception com.ibm.mq.MQException: MQJE001: Completion Code 2, Reason 2085
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Thu Aug 26, 2004 3:13 pm    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
Location: LI,NY

2085 MQRC_UNKNOWN_OBJECT_NAME

Are you sure all your object are defined right and or that you are accessing the right qmgr ?
Back to top
View user's profile Send private message Send e-mail
joerg.sailer
PostPosted: Fri Aug 27, 2004 3:38 am    Post subject: javax.jms.JMSException: MQJMS2008: failed to open MQ queue Reply with quote

Newbie

Joined: 09 Aug 2004
Posts: 4
Location: Germany

Hello,
just check the parameters of the queue-handle-constructor. This exception will also be thrown if you try to USE a wrong/invalid handle.

The parameters of the constructor are named very curious, so I prefer to use the default-constructor MQQueue() and set the queue-manager and the queue-name by using

mqq.setBaseQueueManagerName(queueMgr);
mqq.setBaseQueueName(queueName);


Joerg
Back to top
View user's profile Send private message
bower5932
PostPosted: Fri Aug 27, 2004 6:30 am    Post subject: Reply with quote

Jedi Knight

Joined: 27 Aug 2001
Posts: 3023
Location: Dallas, TX, USA

bower5932 wrote:
There is a mqjms_psq.mqsc file in the java\bin subdirectory that needs to be run to set up JMS queue definitions.


Double-check that you actually used runmqsc with this file against your qmgr. This is the file that defines queues that are needed for subscribers.
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » IBM MQ Java / JMS » question on mqseries pub/sub
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.