Author |
Message
|
jsware |
Posted: Thu Jan 31, 2008 9:17 am Post subject: Publishing to multiple topics simultaneously in JMS |
|
|
 Chevalier
Joined: 17 May 2001 Posts: 455
|
I have a requirement to implement a publish & subscribe interaction from one system to multiple systems.
I have a bunch of common systems and a bunch of warehouse systems (1 system for each warehouse).
The common systems want every publication. Only select warehouses want these publications (in a perm any x from y combination). The publisher knows which warehouses.
Thus I thought that I could have a topic hierarchy such as /MyTopic/{WhseID} and the publisher can publish to multiple topics simultaneously using multiple <Topic> entries in the RFH2 header.
I can subscribe my common systems to /MyTopic "root" and then subscribe each warehouse to /MyTopic/{WhseID} where {WhseID} is that warehouse's ID.
Thus when the publisher publishes to /MyTopic/1 and /MyTopic/2 the common systems get the publication, as does warehouse 1 & 2 but not warehouse 3. Publishing to /MyTopic/1 and /MyTopic/3 means the common systems get the publication as do 1 & 3 but not 2.
While I can do this with the MQAPI & RFH2 header, the publisher is a J2EE application that is using JMS as its API layer to it seemed appropriate to use the pub/sub API in JMS. I have looked at the JMS API and searched mqseries.net and it appears that this might not be possible with the JMS API but I am not convinced.
Am I missing something in JMS pub-sub or does JMS not expose this multiple topic function of MQ/MB pub-sub? _________________ Regards
John
The pain of low quaility far outlasts the joy of low price. |
|
Back to top |
|
 |
jefflowrey |
Posted: Thu Jan 31, 2008 9:23 am Post subject: Re: Publishing to multiple topics simultaneously in JMS |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
scottj2512 wrote: |
The publisher knows which warehouses. |
That's not Pub/Sub.
That's a distribution list. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
jsware |
Posted: Thu Jan 31, 2008 9:28 am Post subject: Re: Publishing to multiple topics simultaneously in JMS |
|
|
 Chevalier
Joined: 17 May 2001 Posts: 455
|
jefflowrey wrote: |
That's not Pub/Sub.
That's a distribution list. |
I am not asking whether its pub/sub or not.
I am asking whether the ability to publish to multiple topics in a single publication, which is possible from the MQAPI, is available in JMS. _________________ Regards
John
The pain of low quaility far outlasts the joy of low price. |
|
Back to top |
|
 |
jefflowrey |
Posted: Thu Jan 31, 2008 9:36 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
You'd have to be able to create a Destination to more than one Topic.
I don't think you can do that. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
jsware |
Posted: Thu Jan 31, 2008 10:31 am Post subject: |
|
|
 Chevalier
Joined: 17 May 2001 Posts: 455
|
jefflowrey wrote: |
You'd have to be able to create a Destination to more than one Topic.
I don't think you can do that. |
That's what I suspected - damn you JMS  _________________ Regards
John
The pain of low quaility far outlasts the joy of low price. |
|
Back to top |
|
 |
jefflowrey |
Posted: Thu Jan 31, 2008 10:42 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
Again, there's already too much information in the hands of the publisher about who the subscribers are and what they want...
You could create proxy topics, and have proxy subscribers that would republish to each topic one at a time.
You could use WMB and content-filtering on your warehouse subscriptions to avoid this mess entirely. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
fjb_saper |
Posted: Thu Jan 31, 2008 2:52 pm Post subject: Re: Publishing to multiple topics simultaneously in JMS |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
scottj2512 wrote: |
I have a requirement to implement a publish & subscribe interaction from one system to multiple systems.
I have a bunch of common systems and a bunch of warehouse systems (1 system for each warehouse).
The common systems want every publication. Only select warehouses want these publications (in a perm any x from y combination). The publisher knows which warehouses.
Thus I thought that I could have a topic hierarchy such as /MyTopic/{WhseID} and the publisher can publish to multiple topics simultaneously using multiple <Topic> entries in the RFH2 header.
I can subscribe my common systems to /MyTopic "root" and then subscribe each warehouse to /MyTopic/{WhseID} where {WhseID} is that warehouse's ID.
Thus when the publisher publishes to /MyTopic/1 and /MyTopic/2 the common systems get the publication, as does warehouse 1 & 2 but not warehouse 3. Publishing to /MyTopic/1 and /MyTopic/3 means the common systems get the publication as do 1 & 3 but not 2.
While I can do this with the MQAPI & RFH2 header, the publisher is a J2EE application that is using JMS as its API layer to it seemed appropriate to use the pub/sub API in JMS. I have looked at the JMS API and searched mqseries.net and it appears that this might not be possible with the JMS API but I am not convinced.
Am I missing something in JMS pub-sub or does JMS not expose this multiple topic function of MQ/MB pub-sub? |
You are attacking the problem from the wrong angle.
This is not a publisher problem it is a subscriber problem.
example you publish to myroot/warehouses/1
Now if you want warehouse 3 to get all the messages for warehouse 1 you subscribe warehouse 3 for its own messages and for those of warehouse 1. (you subscribe warehouse 3 for both topics).
Assuming that only some messages qualify you would need to set up a publication for myroot/warehouses/1and3 and subscribe both warehouses to it.
The publisher does not care and publishes to a topic. The subscribers can subscribe to multiple topics...
Enjoy  _________________ MQ & Broker admin |
|
Back to top |
|
 |
jsware |
Posted: Thu Feb 07, 2008 12:56 am Post subject: Re: Publishing to multiple topics simultaneously in JMS |
|
|
 Chevalier
Joined: 17 May 2001 Posts: 455
|
fjb_saper wrote: |
You are attacking the problem from the wrong angle.
This is not a publisher problem it is a subscriber problem.
example you publish to myroot/warehouses/1
Now if you want warehouse 3 to get all the messages for warehouse 1 you subscribe warehouse 3 for its own messages and for those of warehouse 1. (you subscribe warehouse 3 for both topics).
Assuming that only some messages qualify you would need to set up a publication for myroot/warehouses/1and3 and subscribe both warehouses to it.
The publisher does not care and publishes to a topic. The subscribers can subscribe to multiple topics...
Enjoy  |
I don't want warehouse 1 to get messages for warehouse 2 or 3. I want each w/hse to get messages for its own w/hse. I want a "central" application to get messages for every w/hse. Messages that are produced are relevant for multiple w/hses (sometimes 1+2, sometimes 1+3, sometimes 2+3, sometimes 1/2&3). The central system also wants a copy of the message produced (but only 1 copy).
I cannot have the publisher send out separate publications to w/hse 1+2 because the central system then gets two copies of the message and processes the message twice.
I considered your 1and2 topic hierarchy but it does not scale. If I have 10 warehouses, I have topics coming out of my ears (1, 1and2, 1and3, ..., 1and2and3, ..., 1and2and3and4and5and6and7and8and9and10). 14 w/hses and I (think I) have 105 topics. Each warehouse then needs to know all the other warehouses so it can subscribe to w/hse x, xandy, xandz, oh and wandxandyandz and so on... _________________ Regards
John
The pain of low quaility far outlasts the joy of low price. |
|
Back to top |
|
 |
markt |
Posted: Thu Feb 07, 2008 1:26 am Post subject: |
|
|
 Knight
Joined: 14 May 2002 Posts: 508
|
use properties with a selector |
|
Back to top |
|
 |
|