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 » General Discussion » Publish/Subscribe

Post new topic  Reply to topic Goto page Previous  1, 2, 3  Next
 Publish/Subscribe « View previous topic :: View next topic » 
Author Message
techno
PostPosted: Mon Nov 29, 2004 10:57 am    Post subject: Reply with quote

Chevalier

Joined: 22 Jan 2003
Posts: 429

Say I have QM3 and QM4. QM3 has broker set up. Need to publish the messages from QM4.

I have defined queues using the script MQJMS_PSQ.mqsc.

Shall I define remote queues in QM4 to the queues in MQJMS_PSQ.mqsc of QM3?

If so, which queues?

How should be the code? I guess below lines would require changes...

((MQTopicConnectionFactory) topicConnectionFactory).setBrokerControlQueue("BROKER.CONTROL.QUEUE");

((MQTopicConnectionFactory) topicConnectionFactory).setBrokerPubQueue("BROKER.DEFAULT.STREAM");


Thanks
Back to top
View user's profile Send private message
techno
PostPosted: Mon Nov 29, 2004 12:17 pm    Post subject: Reply with quote

Chevalier

Joined: 22 Jan 2003
Posts: 429

Addition to above:

I can see a message getting added to deadq of Broker's qmgr(QMGR3), whenever there is a message published from remote qmgr(QMGR4). Also getting the exception: com.ibm.mq.jms.NoBrokerResponseException: MQJMS5053: *** No broker response

Thanks
Back to top
View user's profile Send private message
bower5932
PostPosted: Mon Nov 29, 2004 12:50 pm    Post subject: Reply with quote

Jedi Knight

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

Your other append was in a thread that involved using WSAD. I thought that you were trying to use the MA0C environment? Can I also get some more details on what you are trying to do? Are you using an AppServer or just trying to get stand-alone applications to run?
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger
techno
PostPosted: Mon Nov 29, 2004 1:09 pm    Post subject: Reply with quote

Chevalier

Joined: 22 Jan 2003
Posts: 429

This is a stand-alone simple application, trying to run from command prompt. Using JMS and not using JMSAdmin defined objects.

Code is:
Code:
topicConnectionFactory = new MQTopicConnectionFactory();
((MQTopicConnectionFactory) topicConnectionFactory).setQueueManager("QMGR4");

((MQTopicConnectionFactory) topicConnectionFactory).setBrokerQueueManager("QMGR3");         
((MQTopicConnectionFactory) topicConnectionFactory).setBrokerControlQueue("BROKER.CONTROL.QUEUE");
((MQTopicConnectionFactory) topicConnectionFactory).setBrokerPubQueue("BROKER.DEFAULT.STREAM");

         

topicConnection = topicConnectionFactory.createTopicConnection();
topicSession = topicConnection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
topic = topicSession.createTopic("topic://NEWSTOPIC1?brokerVersion=1");

pubSession = topicConnection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
publisher =  pubSession.createPublisher(topic);
TextMessage message = pubSession.createTextMessage();
message.setText("This is message i");
publisher.publish(message);


Defined BROKER.* remote queues on QMGR4 and necessary channels on QMGR3 and QMGR4. I have got ma0c installed on the box.
Back to top
View user's profile Send private message
bower5932
PostPosted: Mon Nov 29, 2004 1:51 pm    Post subject: Reply with quote

Jedi Knight

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

I just did some playing, and I believe that I have this working on my box. I created two qmgrs:

- bqmgr for broker listens on 8888
- sqmgr for subscriber listens on 5555

I used the mqjmspub and mqjmssub that can be found at:

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

My definitions:

bqmgr:
Code:

define channel('bqmgr.to.sqmgr') chltype(sdr) +
  trptype(tcp) conname('localhost(5555)') +
  xmitq('sqmgr') descr('broker to subscriber') +
  replace

def channel('sqmgr.to.bqmgr') chltype(rcvr) +
  trptype(tcp) descr('subscriber to broker') +
  replace

def qlocal('sqmgr') like(SYSTEM.DEFAULT.LOCAL.QUEUE) +
  share usage(xmitq) trigger initq(SYSTEM.CHANNEL.INITQ) +
  replace

def qremote('to.sqmgr') like(SYSTEM.DEFAULT.REMOTE.QUEUE) +
  xmitq('sqmgr') rname('from.bqmgr') rqmname('sqmgr') +
  replace

def qlocal('from.sqmgr') replace

********************************************************************/
* IBM Websphere MQ Support for Java Message Service                */
* Sample MQSC source defining JMS Publish/Subscribe queues.        */
* Installation Verification Test - Setup script                    */
*                                                                  */
* Licensed Materials - Property of IBM                             */
*                                                                  */
* 5648-C60 5724-B4 5655-F10                                        */
*                                                                  */
* (c) Copyright IBM Corp. 1999. All Rights Reserved.               */
*                                                                  */
* US Government Users Restricted Rights - Use, duplication or      */
* disclosure restricted by GSA ADP Schedule Contract with IBM Corp.*/
********************************************************************/

********************************************************************/
*                                                                  */
*   JMS Publish/Subscribe Administration Queue                     */
*                                                                  */
********************************************************************/
**   Create a local queue
    DEFINE QLOCAL('SYSTEM.JMS.ADMIN.QUEUE') REPLACE +
        DESCR('Websphere MQ - JMS Classes - admin queue') +
*   Persistent messages OK
        DEFPSIST(YES)  +
*   Non-Shareable
        NOSHARE

********************************************************************/
*                                                                  */
*   JMS Publish/Subscribe Subscriber Status Queue                  */
*                                                                  */
********************************************************************/
**   Create a local queue
    DEFINE QLOCAL('SYSTEM.JMS.PS.STATUS.QUEUE') REPLACE +
        DESCR('Websphere MQ - JMS Classes - PS status queue') +
*   Persistent messages OK
        DEFPSIST(YES)  +
*   Shareable
        SHARE DEFSOPT(SHARED)

********************************************************************/
*                                                                  */
*   JMS Publish/Subscribe Report Queue                             */
*                                                                  */
********************************************************************/
**   Create a local queue
    DEFINE QLOCAL('SYSTEM.JMS.REPORT.QUEUE') REPLACE +
        DESCR('Websphere MQ - JMS Classes - Report queue') +
*   Persistent messages OK
        DEFPSIST(YES)  +
*   Shareable
        SHARE DEFSOPT(SHARED)

********************************************************************/
*                                                                  */
*   JMS Publish/Subscribe Subscribers Model Queue                  */
*                                                                  */
*   Create model queue used by subscribers to create a permanent   */
*   queue for subsciptions                                         */
*                                                                  */
********************************************************************/
*   General reply queue                                            */
    DEFINE QMODEL('SYSTEM.JMS.MODEL.QUEUE') REPLACE +
        DESCR('Websphere MQ - JMS Classes - Model queue') +
*   Queue Definition Type
        DEFTYPE(PERMDYN) +
*   Shareable
        SHARE DEFSOPT(SHARED)

********************************************************************/
*                                                                  */
*   JMS Publish/Subscribe Default Non-Durable Shared Queue         */
*                                                                  */
*   Create local queue used as the default shared queue by         */
*   non-durable subscribers                                        */
*                                                                  */
********************************************************************/
**   Create a local queue
    DEFINE QLOCAL('SYSTEM.JMS.ND.SUBSCRIBER.QUEUE') REPLACE +
        DESCR('Websphere MQ - JMS Classes - PS ND shared queue') +
*   Persistent messages OK
        DEFPSIST(YES)  +
*   Shareable
        SHARE DEFSOPT(SHARED) +
*   Maximum queue depth
        MAXDEPTH(100000)

********************************************************************/
*                                                                  */
*   JMS Publish/Subscribe Default Non-Durable Shared Queue for     */
*   ConnectionConsumer functionality                               */
*                                                                  */
*   Create local queue used as the default shared queue by         */
*   non-durable connection consumers                               */
*                                                                  */
********************************************************************/
**   Create a local queue
    DEFINE QLOCAL('SYSTEM.JMS.ND.CC.SUBSCRIBER.QUEUE') REPLACE +
        DESCR('Websphere MQ - JMS Classes - PS ND CC shared q') +
*   Persistent messages OK
        DEFPSIST(YES)  +
*   Shareable
        SHARE DEFSOPT(SHARED)  +
*   Maximum queue depth
        MAXDEPTH(100000)

********************************************************************/
*                                                                  */
*   JMS Publish/Subscribe Default Durable Shared Queue             */
*                                                                  */
*   Create local queue used as the default shared queue by durable */
*   subscribers                                                    */
*                                                                  */
********************************************************************/
**   Create a local queue
    DEFINE QLOCAL('SYSTEM.JMS.D.SUBSCRIBER.QUEUE') REPLACE +
        DESCR('Websphere MQ - JMS Classes - PS D shared queue') +
*   Persistent messages OK
        DEFPSIST(YES)  +
*   Shareable
        SHARE DEFSOPT(SHARED)  +
*   Maximum queue depth
        MAXDEPTH(100000)

********************************************************************/
*                                                                  */
*   JMS Publish/Subscribe Default Durable Shared Queue for         */
*   ConnectionConsumer functionality                               */
*                                                                  */
*   Create local queue used as the default shared queue by durable */
*   connection consumers                                           */
*                                                                  */
********************************************************************/
**   Create a local queue
    DEFINE QLOCAL('SYSTEM.JMS.D.CC.SUBSCRIBER.QUEUE') REPLACE +
        DESCR('Websphere MQ - JMS Classes - PS D CC shared q') +
*   Persistent messages OK
        DEFPSIST(YES)  +
*   Shareable
        SHARE DEFSOPT(SHARED)  +
*   Maximum queue depth
        MAXDEPTH(100000)


sqmgr:
Code:

define channel('sqmgr.to.bqmgr') chltype(sdr) +
  trptype(tcp) conname('localhost(8888)') +
  xmitq('bqmgr') descr('subscriber to broker') +
  replace

def channel('bqmgr.to.sqmgr') chltype(rcvr) +
  trptype(tcp) descr('broker to subscriber') +
  replace

def qlocal('bqmgr') like(SYSTEM.DEFAULT.LOCAL.QUEUE) +
  share usage(xmitq) trigger initq(SYSTEM.CHANNEL.INITQ) +
  replace

def qremote('to.bqmgr') like(SYSTEM.DEFAULT.REMOTE.QUEUE) +
  xmitq('bqmgr') rname('from.sqmgr') rqmname('bqmgr') +
  replace

def qlocal('from.bqmgr') replace

def qlocal('SYSTEM.JMS.REPORT.QUEUE') +
  replace

def qlocal('SYSTEM.JMS.ND.sqmgr') +
  descr('holds my subscription messages') +
  replace

def qlocal('SYSTEM.JMS.PS.STATUS.QUEUE') +
  replace

def qremote('SYSTEM.BROKER.CONTROL.QUEUE') like(SYSTEM.DEFAULT.REMOTE.QUEUE) +
  xmitq('bqmgr') rname('SYSTEM.BROKER.CONTROL.QUEUE') rqmname('bqmgr') +
  replace


I used JMSAdmin to create my definitions:
Code:

def ctx(remoteBroker)
chg ctx(remoteBroker)

del tcf(bqmgr.TCF)
del tcf(sqmgr.TCF)
  del t(ma0cTopic)

def tcf(bqmgr.TCF) qmgr(bqmgr) clientid(SUB)
def tcf(sqmgr.TCF) qmgr(sqmgr) clientid(SUB) brokersubq(SYSTEM.JMS.ND.sqmgr)
  def t(ma0cTopic)             topic(ma0cTopic)

end


You should be able to use the above to get your 'jmsadmin' definitions set correctly in your code.

I haven't done a lot of testing. I basically brought up a non-durable subscriber connected to sqmgr, had it subscribe, and receive a message from a publisher connected to bqmgr.

Hope this helps.
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger
techno
PostPosted: Mon Nov 29, 2004 2:46 pm    Post subject: Reply with quote

Chevalier

Joined: 22 Jan 2003
Posts: 429

Thanks for such explanation.

What are we using these queues for? (from.* and to.* )
Back to top
View user's profile Send private message
bower5932
PostPosted: Mon Nov 29, 2004 2:47 pm    Post subject: Reply with quote

Jedi Knight

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

The from.* and to.* queues were so that I could confirm that I had all of the channels and queues set up correctly. I used them with amqsput to make sure things flowed.
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger
techno
PostPosted: Mon Nov 29, 2004 3:07 pm    Post subject: Reply with quote

Chevalier

Joined: 22 Jan 2003
Posts: 429

Thank you for your patience. I have created all the mq objects. Only change is: I am not using JMSAdmin. Please look into my code and tell me what wrong I am doing. Created to.* and from.* queues and the message flow is verified.


topicConnectionFactory = new MQTopicConnectionFactory();
((MQTopicConnectionFactory) topicConnectionFactory).setQueueManager("QMGR4");

((MQTopicConnectionFactory) topicConnectionFactory).setBrokerQueueManager("QMGR3");
((MQTopicConnectionFactory) topicConnectionFactory).setBrokerControlQueue("BROKER.CONTROL.QUEUE");
((MQTopicConnectionFactory) topicConnectionFactory).setBrokerPubQueue("BROKER.DEFAULT.STREAM");



topicConnection = topicConnectionFactory.createTopicConnection();
topicSession = topicConnection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
topic = topicSession.createTopic("topic://NEWSTOPIC1?brokerVersion=1");

pubSession = topicConnection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
publisher = pubSession.createPublisher(topic);
TextMessage message = pubSession.createTextMessage();
message.setText("This is message i");
publisher.publish(message);
Back to top
View user's profile Send private message
techno
PostPosted: Tue Nov 30, 2004 8:59 am    Post subject: Reply with quote

Chevalier

Joined: 22 Jan 2003
Posts: 429

Ha, Finally, it worked...

I commented lines:

((MQTopicConnectionFactory) topicConnectionFactory).setBrokerControlQueue("BROKER.CONTROL.QUEUE");
((MQTopicConnectionFactory) topicConnectionFactory).setBrokerPubQueue("BROKER.DEFAULT.STREAM");

I don't know why it started working.. Could somebody throw light?
Back to top
View user's profile Send private message
bower5932
PostPosted: Tue Nov 30, 2004 11:04 am    Post subject: Reply with quote

Jedi Knight

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

If that is truly what you had in your code, then the reason that it failed before is because you don't have a SYSTEM on the front of your queue names. When you commented out the lines, the default was used (which had the SYSTEM on the front).
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger
techno
PostPosted: Tue Nov 30, 2004 2:55 pm    Post subject: Reply with quote

Chevalier

Joined: 22 Jan 2003
Posts: 429

I have defined them as remote queues pointing to SYSTEM.* on other side (broker qmgr side). Are non-SYSTEM queues not accepted?

Thanks
Back to top
View user's profile Send private message
bower5932
PostPosted: Wed Dec 01, 2004 6:07 am    Post subject: Reply with quote

Jedi Knight

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

Without seeing your definitions, I can't really comment. What I was implying was that it looked like you didn't quite have the name right on one side but did on the other.

The other thing that may have messed you up is that you specified a qmgr on your tcf along with your queue names. However, the queue names that you used existed on your local qmgr not your remote. By specifying the qmgr, you may have messed it up.
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger
techno
PostPosted: Wed Dec 01, 2004 9:12 am    Post subject: Reply with quote

Chevalier

Joined: 22 Jan 2003
Posts: 429

these are the defs on qmgr4, pointing remotely to qmgr3.


dis qr(BROKER.CONTROL.QUEUE)
3 : dis qr(BROKER.CONTROL.QUEUE)
AMQ8409: Display Queue details.
DESCR( ) RNAME(SYSTEM.BROKER.CONTROL.QUEUE)
RQMNAME(QMGR3) XMITQ(QMGR3)
QUEUE(BROKER.CONTROL.QUEUE) ALTDATE(2004-11-24)
SCOPE(QMGR) DEFBIND(OPEN)
TYPE(QREMOTE)


dis qr (BROKER.DEFAULT.STREAM)
6 : dis qr (BROKER.DEFAULT.STREAM)
AMQ8409: Display Queue details.
DESCR( ) RNAME(SYSTEM.BROKER.DEFAULT.STREAM)
RQMNAME(QMGR3) XMITQ(QMGR3)
QUEUE(BROKER.DEFAULT.STREAM) ALTDATE(2004-11-24)
SCOPE(QMGR) DEFBIND(OPEN)
TYPE(QREMOTE)



dis qr (BROKER.ADMIN.STREAM)
7 : dis qr (BROKER.ADMIN.STREAM)
AMQ8409: Display Queue details.
DESCR( ) RNAME(SYSTEM.BROKER.ADMIN.STREAM)
RQMNAME(QMGR3) XMITQ(QMGR3)
QUEUE(BROKER.ADMIN.STREAM) ALTDATE(2004-11-24)
DEFPRTY(0) DEFPSIST(NO)
SCOPE(QMGR) DEFBIND(OPEN)
TYPE(QREMOTE)



dis ql(QMGR3)
8 : dis ql(QMGR3)
AMQ8409: Display Queue details.
DESCR(WebSphere MQ Default Local Queue)
QUEUE(QMGR3) CRDATE(2004-11-24)
RETINTVL(999999999) USAGE(XMITQ)



Do I need to change the names of queues on dest qmgr (qmgr3) also? Am I right with the assumption that broker uses system.broker.* only? Where are system.jms.* used? Of course, I have defined all of these on qmgr3 using the script provided in /opt/mqm/java/bin dir.



Back to top
View user's profile Send private message
fjb_saper
PostPosted: Wed Dec 01, 2004 4:57 pm    Post subject: Reply with quote

Grand High Poobah

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

You did not specify the qmgr on your queues. As you had specified that the broker manager is QMGR3 it tries to put the messages to queue BROKER.DEFAULT.STREAM on QMGR3.
QMGR4 has a default path to QMGR3.
This means that you never attempted to put the messages to the remote queue.

Check out the syntax to define the destination with the qmgr prefix:
setBrokerQueue("QMGR4/BROKER.DEFAULT.STREAM")
OR
Create a qcf on QMGR4 that allows you to define the
Queue = session.createQueue("BROKER.DEFAULT.STREAM") before you instanciate the Topic Factory. You can then pass this queue object to the Topic factory by extracting its name ?

Enjoy
Back to top
View user's profile Send private message Send e-mail
techno
PostPosted: Thu Dec 02, 2004 10:32 am    Post subject: Reply with quote

Chevalier

Joined: 22 Jan 2003
Posts: 429

Curious to know how you do that


Code:
QueueConnectionFactory qConnectionFactory = new MQQueueConnectionFactory();
((MQQueueConnectionFactory) qConnectionFactory).setQueueManager("QMGR4");
QueueConnection qConnection = qConnectionFactory.createQueueConnection();
QueueSession qSession = qConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
Queue qBrokerPubQueue = qSession.createQueue("BROKER.DEFAULT.STREAM");
Queue qBrokerControlQueue = qSession.createQueue("BROKER.CONTROL.QUEUE");

         
topicConnectionFactory = new MQTopicConnectionFactory();
((MQTopicConnectionFactory) topicConnectionFactory).setQueueManager("QMGR4");
((MQTopicConnectionFactory) topicConnectionFactory).setBrokerQueueManager("QMGR3");         
((MQTopicConnectionFactory) topicConnectionFactory).setBrokerPubQueue("BROKER.DEFAULT.STREAM");
((MQTopicConnectionFactory) topicConnectionFactory).setBrokerControlQueue("BROKER.CONTROL.QUEUE");
topicConnection = topicConnectionFactory.createTopicConnection();
topicSession = topicConnection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);

topic = topicSession.createTopic("topic://NEWSTOPIC1?brokerVersion=1");
pubSession = topicConnection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
publisher =  pubSession.createPublisher(topic);
TextMessage message = pubSession.createTextMessage();
message.setText("Hello subscribers..");
publisher.publish(message);



Thanks.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Goto page Previous  1, 2, 3  Next Page 2 of 3

MQSeries.net Forum Index » General Discussion » Publish/Subscribe
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.