Author |
Message
|
Naftalanja |
Posted: Wed Mar 20, 2002 5:29 pm Post subject: |
|
|
Acolyte
Joined: 30 Jan 2002 Posts: 63 Location: Los Angeles
|
Hi all, i have the code as following
sub = (MQTopicSubscriber) session.createSubscriber(topic);
Connection.start();
try
{
msg = sub.receive();
tm = (TextMessage) msg;
} catch (JMSException je)
{
System.out.println("caught " + je);
Exception e = je.getLinkedException();
if(e != null)
{
System.err.println("Linked Exception " + e);
System.out.println("To String " + e.toString());
}
}
But i see that the topics in SYSTEM.BROKER.IQ.1.4 (Queue) and all the messages are sitting in SYSTEM.JMS.ND.* (Queues), how can the application pick the messages ? i mean is there any way that i mention the application to pickup the Messages. The code just waits at sub.receive() Method even though i am publishing messages. IT just hangs in there but the topics are created and the messages are being passed from SYSTEM.BROKER.STREAM.QUEUE, Pliz any help would be greatly appreciated. Thanx
|
|
Back to top |
|
 |
abmanesh |
Posted: Thu Mar 21, 2002 8:21 am Post subject: |
|
|
Apprentice
Joined: 06 Nov 2001 Posts: 39
|
[ This Message was edited by: abmanesh on 2002-03-21 08:22 ] |
|
Back to top |
|
 |
abmanesh |
Posted: Thu Mar 21, 2002 8:32 am Post subject: |
|
|
Apprentice
Joined: 06 Nov 2001 Posts: 39
|
Could you check if it makes any difference, if you start the connection before obtaining the session from it. |
|
Back to top |
|
 |
Naftalanja |
Posted: Thu Mar 21, 2002 9:39 am Post subject: |
|
|
Acolyte
Joined: 30 Jan 2002 Posts: 63 Location: Los Angeles
|
hi abmanesh, yeah it made the difference. Thanx for it. Now i am able to read the message. But i am publishing continously 6 messages but the application reads one message and closes the program. I mean i havent implemented any logic to sit around and keep listening for messages. But my question is if i do that then it would be like p2p rite ?? except that we are using diff queues. Also is there any way that i can specify a local queue which i have created say MY.LOCALQ as the Queue for picking up the susbsriptions. I dont want to use JMS.*.* etc queues. Thanx for your help.
|
|
Back to top |
|
 |
abmanesh |
Posted: Thu Mar 21, 2002 11:53 am Post subject: |
|
|
Apprentice
Joined: 06 Nov 2001 Posts: 39
|
For continuos processing you could implement a looping logic. You cannot relate the pub/sub model to a p2p model though. The only way it comes close to a p2p model is when you have only one subsriber in the entire system for a topic. p2p and pub/sub are more of design level abstraction of messaging implementation.
If you want to specify queues other than the default queues in Pub/Sub model you could do it when you define the JNDI objects using JMSAdmin tool. Change the Appropriate object names in the following command for defining the topic connection factory using JMSAdmin .
DEF TCF(name)TRANSPORT(CLIENT)QMANAGER(QueueManagerName)HOST(HostName)
PORT(1414)CHANNEL(JMS.SRV.CHNL)BROKERQMGR(QueueManagerName)
BROKERCONQ(SYSTEM.BROKER.CONTROL.QUEUE)
BROKERPUBQ(SYSTEM.BROKER.DEFAULT.STREAM)
BROKERSUBQ(SYSTEM.JMS.ND.SUBSCRIBER.QUEUE)
BROKERCCSUBQ(SYSTEM.JMS.ND.CC.SUBSCRIBER.QUEUE) |
|
Back to top |
|
 |
Naftalanja |
Posted: Thu Mar 21, 2002 3:29 pm Post subject: |
|
|
Acolyte
Joined: 30 Jan 2002 Posts: 63 Location: Los Angeles
|
Abnamesh, thanx again but i am not using JNDI though, would it be possible for me to mention the Queue otherwise. Like in MQSI when we write the ESQL in compute node lets say, we can specify the Queue from which you are going to subscribe. thanx |
|
Back to top |
|
 |
abmanesh |
Posted: Fri Mar 22, 2002 12:22 pm Post subject: |
|
|
Apprentice
Joined: 06 Nov 2001 Posts: 39
|
You can create factory objects for pub/sub at
runtime using the MQSeires class MQTopicConnectionFactory (this class is in com.ibm.mq.jms package).
However, using this method reduces the portability of the JMS application
since it references the MQSeries specific classes.
Using the set methods in this class you can set all the information, that you would otherwise specify, when creating the TopicConnectionFactory object in JNDI name space using JMSAdmin tool.
Eg. you could set the Broker Queue Manager using
setBrokerQueueManager(Sting brokerQueueManagerName) in the MQTopicConnectionFactoryClass
|
|
Back to top |
|
 |
Naftalanja |
Posted: Wed Mar 27, 2002 2:53 pm Post subject: |
|
|
Acolyte
Joined: 30 Jan 2002 Posts: 63 Location: Los Angeles
|
Abnamesh, i have used that API for TopocConnectionFactory for setting the Broker QueueManager but how to set the subscriptictions for a particular queue using this API. thanx |
|
Back to top |
|
 |
|