Author |
Message
|
semasaba |
Posted: Wed May 21, 2008 3:50 am Post subject: Topic Wildcard Problem |
|
|
Novice
Joined: 21 May 2008 Posts: 17
|
Hi all,
I wrote a small JMS publisher example and everything works fine.
The only problem is to use a wildcard for my topic.
When I insert a wildcard '*' for my publisher topic, I get following error:
com.ibm.mq.jms.BrokerCommandFailedException: Broker command failed: MQRCCF_TOPIC_ERROR Reason code 3072
Here my example:
MQTopicConnectionFactory cf = new MQTopicConnectionFactory();
// Config
cf.setHostName("myHost");
cf.setPort(myPort);
cf.setTransportType(JMSC.MQJMS_TP_CLIENT_MQ_TCPIP);
cf.setQueueManager("myQueue");
TopicConnection connection = cf.createTopicConnection("MUSR_MQADMIN","");
// Start the connection
connection.start();
TopicSession session = connection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
Topic topic = session.createTopic("topic://TravelGuides/*" );
TopicPublisher publisher = session.createPublisher(topic);
Message message = session.createTextMessage();
publisher.publish(message); //<--Exception!!!!
Thanks a lot!
Marco |
|
Back to top |
|
 |
AkankshA |
Posted: Wed May 21, 2008 3:57 am Post subject: |
|
|
 Grand Master
Joined: 12 Jan 2006 Posts: 1494 Location: Singapore
|
Might be of help.... not sure though considering my illiteracy for java
from infocenter
Quote: |
This reason code is returned by a broker to indicate that the topic name has an invalid length or contains invalid characters. Note that wildcard topic names are not allowed for Register Publisher and Publish commands. See WebSphere® MQ Publish/Subscribe User's Guide for more information on this error code |
_________________ Cheers |
|
Back to top |
|
 |
Vitor |
Posted: Wed May 21, 2008 4:01 am Post subject: Re: Topic Wildcard Problem |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
semasaba wrote: |
The only problem is to use a wildcard for my topic.
|
How can a topic be published with a wildcard?
I don't just mean the software throws an error if you try, I mean logically, from a design perspective, how can a topic which contains a discrete body of information be described as "well it's all this"?
What's your requirement here? _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
semasaba |
Posted: Wed May 21, 2008 4:53 am Post subject: |
|
|
Novice
Joined: 21 May 2008 Posts: 17
|
|
Back to top |
|
 |
Vitor |
Posted: Wed May 21, 2008 4:58 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
semasaba wrote: |
wow, thank you for the fast reply.
My scenario is to have many clients/subscriber which are listening for a message. I want to seperate the clients in several groups because I don't want to send the message to all clients. Therefore I want to create hirarchical groups and want to control the receivers with topics an wildcards. |
Yes, but why publish with a wildcard? Page 17 of your included presentation talks (rightly) about subscribing with a wildcard, and I agree you could use this to group subscribers. But again I ask why publish with a wildcard? What is that supposed to represent? Does it not (even if it worked) defeat your grouping concept by allowing multiple subscriber groups to access it? _________________ Honesty is the best policy.
Insanity is the best defence.
Last edited by Vitor on Wed May 21, 2008 5:01 am; edited 1 time in total |
|
Back to top |
|
 |
semasaba |
Posted: Wed May 21, 2008 4:59 am Post subject: |
|
|
Novice
Joined: 21 May 2008 Posts: 17
|
what's your advice for this scenario?
How would you do that? |
|
Back to top |
|
 |
Vitor |
Posted: Wed May 21, 2008 5:02 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
semasaba wrote: |
what's your advice for this scenario?
How would you do that? |
I'd do what it describes in the presentation you included. Which seems to be more or less what you described as your proposed solution.
I'm still struggling to see what you're attempting to achieve here over & above a "normal" pub/sub scenario. Because you seem (from the details you've provided) to have a fairly normal pub/sub scenario.
There is clearly a complexity I'm missing. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
semasaba |
Posted: Wed May 21, 2008 5:09 am Post subject: |
|
|
Novice
Joined: 21 May 2008 Posts: 17
|
I really don't know what you mean .
What's the difference between my example and the pdf?
Have you seen page 17 in this pdf?
He's also using wildcards in his topic to group the receivers?
That's exactly what I want!
Do you have any precise advices? |
|
Back to top |
|
 |
semasaba |
Posted: Wed May 21, 2008 5:13 am Post subject: |
|
|
Novice
Joined: 21 May 2008 Posts: 17
|
ah ok!
I think I understand know what you mean.
The difference is that I use wildcards for the publisher instead for the subscriber. |
|
Back to top |
|
 |
Vitor |
Posted: Wed May 21, 2008 5:16 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
semasaba wrote: |
What's the difference between my example and the pdf? |
The topic names you're attempting to publish
semasaba wrote: |
Have you seen page 17 in this pdf? |
Oddly, I had a look before I replied to your post. I felt it would help.
semasaba wrote: |
He's also using wildcards in his topic to group the receivers? |
I believe so. It's a common enough construct.
semasaba wrote: |
That's exactly what I want! |
It certainly sounds like it. I still fail to see what this has to do with the publish problem you're quoting, or what these topics you're publishing are describing. Again I ask what, conceptually, do these topics describe?
semasaba wrote: |
Do you have any precise advices? |
Frankly, use the conventional pub/sub model. It seems to fit your needs and is less trouble than whatever it is you're building here.  _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
Vitor |
Posted: Wed May 21, 2008 5:18 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
semasaba wrote: |
The difference is that I use wildcards for the publisher instead for the subscriber. |
Exactly. What does a topic, published with a wildcard in it's topic name, describe? It describes a topic which is more than one thing and valid for more than one subscriber. This doesn't appear to be the desired result you're describing. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
semasaba |
Posted: Wed May 21, 2008 6:37 am Post subject: |
|
|
Novice
Joined: 21 May 2008 Posts: 17
|
Ok, thank you.
Do you have any idea how to solve my problem?
If you view the example from the pdf, how should
I describe the publisher and the subscriber if I want to
send the first time a message only to Tyrol and after that a massage
to Austria. If I sent a message to Austria, all subscribers from subtopics should be informed.
First case:
Publisher -> TravelGuides/Austria/Regions/Tyrol
Subscriber -> TravelGuides/Austria/Regions/Tyrol
Second case:
Publisher -> TravelGuides/Austria/
Subscriber -> ???
For the second case I don't want to create a new subscriber. Is it possible to modify the subscriber to use it for both cases? |
|
Back to top |
|
 |
Vitor |
Posted: Wed May 21, 2008 6:48 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
semasaba wrote: |
For the second case I don't want to create a new subscriber. Is it possible to modify the subscriber to use it for both cases? |
Yes.
 _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
fjb_saper |
Posted: Wed May 21, 2008 1:22 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
semasaba wrote: |
Ok, thank you.
Do you have any idea how to solve my problem?
If you view the example from the pdf, how should
I describe the publisher and the subscriber if I want to
send the first time a message only to Tyrol and after that a massage
to Austria. If I sent a message to Austria, all subscribers from subtopics should be informed.
First case:
Publisher -> TravelGuides/Austria/Regions/Tyrol
Subscriber -> TravelGuides/Austria/Regions/Tyrol
Second case:
Publisher -> TravelGuides/Austria/
Subscriber -> ???
For the second case I don't want to create a new subscriber. Is it possible to modify the subscriber to use it for both cases? |
A subscriber can subscribe to multiple topics.
So general topics would be
Publisher->TravelGuides/Austria
Subscriber->TravelGuides/Austria
Subscriber->TravelGuides/Austria/# -- would receive everything to do with Austria
Subscriber->TravelGuides/Austria/Regions -- generic regions stuff valid for all regions
Subscriber->TravelGuides/Austria/Regions/Tyrol -- redundant if you use the "everything to do with Austria".
It all depends on what you publish where and how...
 _________________ MQ & Broker admin |
|
Back to top |
|
 |
semasaba |
Posted: Fri May 23, 2008 12:03 am Post subject: |
|
|
Novice
Joined: 21 May 2008 Posts: 17
|
fjb_saper wrote: |
A subscriber can subscribe to multiple topics.
|
How can I subscribe one subscriber to multiple topics ?
.....
TopicSession session = connection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
Topic topic = session.createTopic("topic://TravelGuides/*" );
TopicSubscriber subscriber = (TopicSubscriber) session.createSubscriber(topic);
....
I think I have exactly the same problem like scottj2512:
http://www.mqseries.net/phpBB2/viewtopic.php?t=41643&sid=25ad75b97d7a6728537b6a73837e0fe6
Once again:
I have these three publisher:
Publisher 1->TravelGuides/Austria/Regions/Tyrol
Publisher 2->TravelGuides/Austria/Regions/Salzburg
Publisher 3->TravelGuides/Austria/
and I want two subscriber:
Subscriber 1-> receive message from publisher 1+3
Subscriber 2-> receive message from publisher 2+3
Is that not possible?  |
|
Back to top |
|
 |
|