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 Installation/Configuration Support » pub sub im MQ 6.O ....PROBLEM

Post new topic  Reply to topic
 pub sub im MQ 6.O ....PROBLEM « View previous topic :: View next topic » 
Author Message
In_love_with_MQ
PostPosted: Fri Mar 10, 2006 8:10 am    Post subject: pub sub im MQ 6.O ....PROBLEM Reply with quote

Acolyte

Joined: 10 Jul 2005
Posts: 70

I am trying PUB SUB option provided in MQ 6.0 .

I have developed three java programs
I have started the Broker using strmqbrk and it is running.


1) To reg publish where i am putting the register Publish into the CONTROL Queue created as a MQRFH message.


final public static String commandQueue = "BROKER.CONTROL.QUEUE";

final public static String MQPS_COMMAND_B = "MQPSCommand ";
final public static String MQPS_REGISTER_PUBLISHER = "RegPub ";
final public static String MQPS_TOPIC = "Stock/IBM ";
final public static String MQPS_TOPIC_B = " MQPSTopic ";


brokerQueue.put (requestMsg, pmo);



2) Now i am creating a Subscription

final public static String MQPS_COMMAND_B = "MQPSCommand ";
final public static String MQPS_REGISTER_PUBLISHER = "RegSub ";
final public static String MQPS_TOPIC = "Stock/* ";
final public static String MQPS_TOPIC_B = "MQPSTopic ";
final public static String MQPS_QM_NAME = "MQPSQMgrName ";
final public static String MQPS_QM = "X1 ";
final public static String MQPS_QUEUE_NAME = "MQPSQName ";
final public static String MQPS_QUEUE = "UNDA ";


again putting into control q

commandQueue = "BROKER.CONTROL.QUEUE";


brokerQueue.put (requestMsg, pmo);


3) Now i am publishing an info into the stream Q .

final public static String MQPS_COMMAND_B = "MQPSCommand ";
final public static String MQPS_REGISTER_PUBLISHER = "Publish ";
final public static String MQPS_TOPIC = "Stock/wipro ";
final public static String MQPS_TOPIC_B = " MQPSTopic ";



final public static String brokerDefaultStream = "BROKER.DEFAULT.STREAM";


streamQueue.put (requestMsg, pmo);

ISSUE
=====
A)
Now i see that there are No messages in subscription Q ?
which is UNDA .......


B) i HAVE STARTED BROKER ????

C) WHEN I USED THE DEFAULT CONTROL AND STREAM QUEUES ALSO it did not work ........

Can u please guide where i am wrong ????????
Should i do something to make the broker know that the control is manual and not default ?????
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Fri Mar 10, 2006 8:16 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

First things first.

You didn't show us the steps where you bulid the various messages.

So instead of putting them to the control queue, put them to a test queue.

Then use amqsbcg to dump them out.

Then use rfhutil from IH03 to create duplicate messages. Put those to a test queue.

Use amqsbcg to dump them out.

Compare the two and adjust your code until they are the same.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Fri Mar 10, 2006 2:25 pm    Post subject: Reply with quote

Grand High Poobah

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

In_love_with_MQ wrote:
streamQueue.put (requestMsg, pmo);


Are you by any chance using java base?

You need an RFH header for pub/sub so PLEASE use JMS!

Enjoy!
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
In_love_with_MQ
PostPosted: Sat Mar 11, 2006 2:31 am    Post subject: I AM PUTTING MQRFH MESSAGE Reply with quote

Acolyte

Joined: 10 Jul 2005
Posts: 70

Hi saper ,

I am putting a MQRFH based message using java base

Here is the code


import java.io.*;
import java.util.*;
import com.ibm.mq.*;

public class publish
{
final public static String MQFMT_RF_HEADER = "MQHRF ";
final public static byte [] MQRFH_STRUC_ID = {'R','F','H',' '};
final public static byte [] MQFMT_STRING_ARRAY = {'M','Q','S','T','R',' ',' ',' '};
final public static int MQRFH_VERSION_1 = 1;
final public static int MQRFH_STRUC_LENGTH_FIXED = 32;
final public static int MQRFH_NONE = 0x00000000;
final public static int MQRC_UNKNOWN_OBJECT_NAME = 2085;
final public static int MQRC_NO_MSG_AVAILABLE = 2033;

final public static String MQPS_COMMAND_B = "MQPSCommand ";
final public static String MQPS_REGISTER_PUBLISHER = "RegPub ";
final public static String MQPS_TOPIC = "Stock/wipro ";
final public static String MQPS_TOPIC_B = " MQPSTopic ";


final public static String commandQueue = "SYSTEM.BROKER.CONTROL.QUEUE";
final public static String brokerDefaultStream = "BROKER.DEFAULT.STREAM";


public static void main (String [] args)

{
try{
MQQueueManager qMgr;
MQQueue brokerQueue;
MQPutMessageOptions pmo = new MQPutMessageOptions ();
MQMessage requestMsg = new MQMessage ();
pmo.options = MQC.MQPMO_NEW_MSG_ID;
String requestStr;
qMgr = new MQQueueManager ("X1");
brokerQueue = qMgr.accessQueue (commandQueue,
MQC.MQOO_OUTPUT, "", "", "mqm");

StringBuffer nameValues = new StringBuffer (MQPS_COMMAND_B + MQPS_REGISTER_PUBLISHER);

nameValues.append (MQPS_TOPIC_B);
nameValues.append (MQPS_TOPIC);


while ( (nameValues.length () % 16) != 0 )
{
nameValues.append (" ");
}

requestStr = nameValues.toString();
requestMsg.feedback = MQC.MQFB_NONE;
requestMsg.format = MQFMT_RF_HEADER;
requestMsg.encoding = MQC.MQENC_NATIVE;
requestMsg.characterSet = MQC.MQCCSI_Q_MGR;
requestMsg.write (MQRFH_STRUC_ID); //StructId
requestMsg.writeInt (MQRFH_VERSION_1); //RFH Version
requestMsg.writeInt (MQRFH_STRUC_LENGTH_FIXED + requestStr.length());
requestMsg.writeInt (MQC.MQENC_NATIVE); //Encoding
requestMsg.writeInt (MQC.MQCCSI_INHERIT); //qmgr CCSID
requestMsg.write (MQFMT_STRING_ARRAY); //Format
requestMsg.writeInt (MQRFH_NONE); //Flags
requestMsg.writeBytes (requestStr);
brokerQueue.put (requestMsg, pmo);
qMgr.commit();
qMgr.disconnect();
}
catch(Exception e)
{System.out.println(e);}
}
}



Hope i am not wrong ???
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Sat Mar 11, 2006 5:09 am    Post subject: Reply with quote

Grand High Poobah

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

Wrong, not necessarily, but making things very complicated for yourself. ==> bad karma. You need to look at the KISS principle.(Keep it simple stupid).

JMS will handle the RFH header for you with the alignment and all the other little niceties that you might miss.

JMS will support put/sub behind the scenes in its implementation when you create the topic (Session.createTopic("topic:///mytopic"); when you subscribe and finally when you publish: producer.publish(msg, topic); whether with known topic or anonymous producer...

Enjoy
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » IBM MQ Installation/Configuration Support » pub sub im MQ 6.O ....PROBLEM
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.