Author |
Message
|
aerosteak |
Posted: Mon May 16, 2011 1:00 pm Post subject: PubSub: Multiple Topic vs JMS Selectors |
|
|
 Newbie
Joined: 16 Oct 2008 Posts: 9
|
Hello,
in a PubSub scenario, what are the pro’s and con`s of filtering messages using:
Option 1) Publishing everything in a single Topic and consumers uses JMS Selector
Option 2) Subscriber subscribe to one or multiple Topic.
For example, I am publishing Client Data in a Topic.
In option 1 I would have JMS Properties:
ClientType=INDIVIDUAL or ORGA or etc
EventType=CREATE or UDPATE or DELETE or etc
OrgUnit= BankA or BankB or etc
Then subscriber can use JMS selectors to get only events of type CREATE with a client type = Individual for BankA.
In Option 2 I can create have multiple Topic: EventType/OrgUnit/ClientType.
Thank you |
|
Back to top |
|
 |
mqjeff |
Posted: Mon May 16, 2011 2:59 pm Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
JMS Selectors are in general, slower than not using them.
That said, you should find a happy balance between an overly complex topic tree and an overly simple topic tree. The topic tree should provide meaningful information about the subscription.
You should also consider use of Message Broker's ability to provide content-based filtering to handle the same task you're using selectors to handle... |
|
Back to top |
|
 |
gbaddeley |
Posted: Mon May 16, 2011 3:41 pm Post subject: |
|
|
 Jedi Knight
Joined: 25 Mar 2003 Posts: 2538 Location: Melbourne, Australia
|
Even though JMS Selectors are much more efficient in MQ v7.0 and later, using a topic tree effectively moves the message marshalling / selection / delivery into the queue manager's pub/sub broker engine. A topic tree heirarchy like BankOrgUnit/ClientType/EventType seems to be the natural functional breakdown. _________________ Glenn |
|
Back to top |
|
 |
aerosteak |
Posted: Mon May 16, 2011 4:26 pm Post subject: |
|
|
 Newbie
Joined: 16 Oct 2008 Posts: 9
|
Thank you for your response.
gbaddeley: When you say that when using a Topic the marhsaling/selection is done by the Broker, I was under the impression that it was also the case for JMS Selector. That the JMS Selector filtering was applied at the broker not by the client?
Does JMS bring all Messages on the client and Then apply the filtering? (I hope not)
Thank you very much for your help (it migh save me another workshop with an IBM SME) |
|
Back to top |
|
 |
fjb_saper |
Posted: Mon May 16, 2011 7:42 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
aerosteak wrote: |
Thank you for your response.
gbaddeley: When you say that when using a Topic the marhsaling/selection is done by the Broker, I was under the impression that it was also the case for JMS Selector. That the JMS Selector filtering was applied at the broker not by the client? |
True for V7. However this is done in vastly different manners.
Publishing to a specific topic and the subscription to it or selecting messages by attributes within a topic are 2 hugely different actions.
Feel free to try it out to evaluate the performance implications and report them here.
aerosteak wrote: |
Does JMS bring all Messages on the client and Then apply the filtering? (I hope not) |
Sadly this is the way it is done in V6. This is one of the most compelling reasons to only select by msgid, correlid, groupid and only in their native form
aerosteak wrote: |
Thank you very much for your help (it might save me another workshop with an IBM SME) |
Have fun  _________________ MQ & Broker admin |
|
Back to top |
|
 |
aerosteak |
Posted: Tue May 17, 2011 6:05 pm Post subject: |
|
|
 Newbie
Joined: 16 Oct 2008 Posts: 9
|
Thank Grand Poobah
Yes, Topic and Selector are quite a different concept, yet they both can be used by a consumer to get only a subset of the message.
My dilemma is the following:
I am Publishing Client Data Message and Subscriber might want to get only a particular type of client. A client types is store in different attribute like ‘ClientGroup’ ‘ClientSource’ ‘ClientOrgUnit’ ‘ClientSize’ etc
What should I do:
1) Create a different Topic for each client type
OR
2) Have each attribute in a JMS Property and use Selectors?
Thank you |
|
Back to top |
|
 |
fjb_saper |
Posted: Tue May 17, 2011 8:28 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
It Depends on your needs. A hierarchical topic tree might be better suited.
But depending on your aggregates you might need multiple trees and each message to be published multiple times...
It might be easier to just set up one tree / topic and have all messages be put into a DB with a field for each of the criteria.
You can then pull the messages from the DB by which ever criteria mix you need.
Have fun  _________________ MQ & Broker admin |
|
Back to top |
|
 |
|