|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
How to create a topic in IBM Websphere MQ 6.0 |
« View previous topic :: View next topic » |
Author |
Message
|
gupta.prashant2279 |
Posted: Mon May 01, 2006 7:40 am Post subject: How to create a topic in IBM Websphere MQ 6.0 |
|
|
Newbie
Joined: 01 May 2006 Posts: 3
|
Hi,
I need to run a simple JMS program on IBM Websphere MQ6.0 wherein I need to publish a message to a
topic and subscriber (running in another JVM) will recive the message from the topic.
I have the JMS program and the broker on IBM Websphere MQ is also running. My problem is how should I
create topic? I know for P2P how to create queues on windows. But I do not know how to create Topics?
I know the topics need to be bound with JMSadmin tool. But the actual problem is in creating the
topic administered object. Could somebody help please?
Regards
Prashant |
|
Back to top |
|
 |
vennela |
Posted: Mon May 01, 2006 7:59 am Post subject: |
|
|
 Jedi Knight
Joined: 11 Aug 2002 Posts: 4055 Location: Hyderabad, India
|
You are on right track.
If you open the JMSPubSub.java example supplied with the MQ product, there are comments on how to run it. If you closely follow it you will understand how to run it.
After reading it, if you still have problems, post here and somebody will be glad to help you. |
|
Back to top |
|
 |
gupta.prashant2279 |
Posted: Tue May 02, 2006 12:31 am Post subject: |
|
|
Newbie
Joined: 01 May 2006 Posts: 3
|
Hi Vennela,
Thanks for the reply. I am still unable to run my program. I will tell the steps which I am following for running JMSPubSub.java for IBM Websphere MQ 6.0.
1. Created a Queue Manager (QM)
2. Started the broker service of that QM
3. run the following commands to configure the broker
runmqsc < MQJMS_PSQ.mqsc
4. Configured the JMSAdmin.config
5. Bound the topic and topic connection factory with the following commands
DEFINE TCF(PubSub.TCF)
DEFINE T(PubSub.T) TOPIC(MQJMS/Samples/PubSub)
6. Running the sample
The output is that I am able to run as the publisher i.e. I am able to post a message to the topic. But when I try to run the subscriber (in another JVM), it is not able to pickup the message. It says..No message!!
No my problem is that I have only created the "JNDI Bindings" for Topic and Topic connection factory. I have NOT created "Topic" anywhere like I create "Queues" using MQ Explorer. Then where will the message be stored? Thus my subscriber program also is not able to pickup the message.
If I run the publisher and subscriber both in the same JVM, both works fine.But this is not a production scenario. Publisher and subscribers have to be in different JVM in my case like the sender and receiver of messages in P2P scenario.
Thanks in advance.
Regards
Prashant |
|
Back to top |
|
 |
mvic |
Posted: Tue May 02, 2006 12:50 am Post subject: |
|
|
 Jedi
Joined: 09 Mar 2004 Posts: 2080
|
gupta.prashant2279 wrote: |
The output is that I am able to run as the publisher i.e. I am able to post a message to the topic. But when I try to run the subscriber (in another JVM), it is not able to pickup the message. It says..No message!! |
Short answer: start the subscriber first, then start the publisher. (But do you really want a pub/sub design here?)
Long answer: you should not expect the above scenario to deliver a message to the subscriber, because the subscriber is not subscribed at the time the publisher is publishing its message. The scenario you appear to be designing is a persistent point-to-point scenario - ie. put message at one time, and the message persists until a later time when a program starts, connects to MQ, and gets the message.
Hope this helps
EDIT: change "is not running" to "is not subscribed" in 2nd paragraph.
Last edited by mvic on Tue May 02, 2006 2:53 am; edited 1 time in total |
|
Back to top |
|
 |
saketr |
Posted: Tue May 02, 2006 2:09 am Post subject: |
|
|
Apprentice
Joined: 08 Feb 2006 Posts: 41
|
Quote: |
I have NOT created "Topic" anywhere like I create "Queues" using MQ Explorer |
Prashant, Topics are created on-the-fly for you, and hence do not require to be manually created like Queues using MQ Explorer.
The default messaging provider in WebSphere Application Server v6 also has similar behaviour - queues need to be explicitly created, topics are created for you.
Another thing to note is that you must start a connection before the subscriber can receive messages, however, publisher should be able to send messages without connection being started - this is as per JMS spec. Ideally, you should start the connection first, and then send/receive messages.
Regards,
Saket |
|
Back to top |
|
 |
gupta.prashant2279 |
Posted: Tue May 02, 2006 4:27 am Post subject: |
|
|
Newbie
Joined: 01 May 2006 Posts: 3
|
Thanks Saket / MVIC,
My problem is solved now. I was missing on the fundamentals that the subscriber has to be subscribed before the publisher publishes the message.
I started the subscriber first and publisher later. My subscriber received the message.
MVIC,
I need the pub sub domain as my requirement is there can be multiple receivers of the same message. Another requirement is that the subscriber might be inactive at the time of publishing the message. When it comes back, it should be able to recieve the message. This can be achieved by creating the durable subscriber. Durable subscriber can be created by the program using the method
createDurableSubscriber()
This method asks for client ID also as the second parameter, first parameter being the topic. ClientId can be unique string identifying the subscriber uniquely. You have to set the client ID first using TopicConnection.setClientID(ClientID). Same ClientID should be given to the createDurableSubscriber() as the second parameter.
Thanks a lot for all your help
Regards
Prashant |
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
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
|
|
|
|