ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » IBM MQ API Support » Pub/Sub and retained messages, only one can be retained?

Post new topic  Reply to topic
 Pub/Sub and retained messages, only one can be retained? « View previous topic :: View next topic » 
Author Message
ChrisH
PostPosted: Sat Feb 28, 2009 7:17 am    Post subject: Pub/Sub and retained messages, only one can be retained? Reply with quote

Newbie

Joined: 26 Feb 2009
Posts: 6

Hi first off let me warn you I'm a newbie to MQ, so please bear with me.
We're working on some POC stuff for the company and were planning on putting up (publishing) a bunch of files then having a subscriber read them spit out some data from them and go to the next one.

In reading the documentation about Topics and Retaining them, I saw this:
Quote:
Only one publication can be retained at each node of the topic tree. That means if there already is a retained publication for this topic, published by any other application, it is replaced with this publication. It is recommended that you do not have more than one publisher retaining messages on the same topic.


Does this mean that a publication can really only be "transitory"? By that I mean that only one topic can be retained on the topic at a time.

If so then I guess the best way is to have a queue and let it hold them and then let the topic grab from that queue and publish them.

Any better ideas or clarification you guys could give me would help.

Christopher
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Sat Feb 28, 2009 12:07 pm    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
Location: LI,NY

Think of a publication of the NY exchange.
When you register your subscription you would like to know the latest values of all stocks...

But you are not interested in stock history....

However the publication happens on event. How can a new subscriber get the latest values without it being published all the time? Retention!

Ok so the topic tree would be something like topic://stocks/nyse/ticker
This way you could subscribe to topic://stocks/nyse# and get the latest values for all tickers. Once a new value is published it replaces the retained value of the same ticker.

If your topic tree looks more like topic://stocks/ticker/nyse you could subscribe to a specific ticker and see what the values throughout the different exchanges are.... (Euronext, nyse, hangsei ...)

The retained value is then always the last published.
As a subscriber you can retrieve the retained value at subscription time and thus get the latest even though you missed it at publication time.

What the documentation is saying is that this might get messy very quickly if you have multiple publishers publishing on a retained topic. Whose publication do you expect as being the retained one? This is why you should have a unique publishing authority per retained topic. Multiple topics can share that unique publishing authority. (i.e. stock exchange publishing the official rates)...

Have fun
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
ChrisH
PostPosted: Sun Mar 01, 2009 7:35 am    Post subject: Pub/Sub and retained messages, only one can be retained? Reply with quote

Newbie

Joined: 26 Feb 2009
Posts: 6

Right and that makes sense. So if for example I wanted to be able to have all the replies that have gone on as far as this topic published to any group of subscribers, I'd have to have a queue (MQQueue) or some other repository set up to hold/stage them, then put them each on the Topic to be shot out to any current subscribers right?

Just making sure I'm doing things (within reason) the BP way and the best way.

Thanks saper,
Christopher
Back to top
View user's profile Send private message
zpat
PostPosted: Sun Mar 01, 2009 8:26 am    Post subject: Reply with quote

Jedi Council

Joined: 19 May 2001
Posts: 5866
Location: UK

Use durable subscriptions to get all published messages sent to a queue.

Otherwise only the last one is retained by the broker.

Depends whether you are dealing with event messages or status update messages.
Back to top
View user's profile Send private message
mqjeff
PostPosted: Sun Mar 01, 2009 9:14 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

It's really not clear what you want to happen, nor why you want to use Pub/Sub for this.

A retained publication allows a new subscriber to receive the last publication on a topic, rather than having to wait for the next publication.

A durable subscription allows a subscriber to receive all publications made *after* subscription, regardless of whether the subscriber is active at the time of publication or not.

There's nothing that allows a new subscriber to get *all* publications on a topic, since the beginning of time. It doesn't make any sense in a pub/sub model.

If, somehow, you really need to be able to have a new subscriber get the entire history of the world when it subscribes, you need to implement something to hold that history and provide it on request. But you would never ever want to replay that history through the "normal" topic - because then everyone would be getting the entire history of the world.

Go back to the whiteboard. Think about the situation that you need to build for from a producer side and from a consumer side. Maybe you just need to load the files into a database, and have a request/reply model to retrieve records from the database.
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Sun Mar 01, 2009 9:29 am    Post subject: Re: Pub/Sub and retained messages, only one can be retained? Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
Location: LI,NY

ChrisH wrote:
Right and that makes sense. So if for example I wanted to be able to have all the replies that have gone on as far as this topic published to any group of subscribers, I'd have to have a queue (MQQueue) or some other repository set up to hold/stage them, then put them each on the Topic to be shot out to any current subscribers right?

Just making sure I'm doing things (within reason) the BP way and the best way.

Thanks saper,
Christopher

Looks like you are getting confused with a different model here.
pub/sub is really good at what it does but it does not cater for the full "Magazine" model.
So pub/sub would only give you the current issue of a Magazine... allowing for retained publication of such.
However if a subscriber comes in late (durable or not) and wants back issues there is no way to cater to that.

What you can do is create a library (DB) that subscribes to the magazine and stores any publication it receives. Now if you want back copies you as a subscriber have to call the library service and request them. This is not part of a pub/sub because all subscribers are obviously not interested in what you (the particular subscriber) want. This should be a request / response service and it could even be asynchronous.

To go back to the wall street analogy, if you want the rates for a particular stock over the last 5 years, the general population subscribed to the instant rates could care less about it. It would even be detrimental to publish it as it would affect the retained value and could introduce an incorrect (obsolete) rate.

Have fun.
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
ChrisH
PostPosted: Sun Mar 01, 2009 10:08 am    Post subject: Pub/Sub and retained messages, only one can be retained? Reply with quote

Newbie

Joined: 26 Feb 2009
Posts: 6

Yeah it's seeming that I'm not looking at the right model I agree and the Pub/Sub makes sense in the other contexts. Thanks for your help and I'll try and see what I can come up with as a better model (or set of models) to handle the situation.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » IBM MQ API Support » Pub/Sub and retained messages, only one can be retained?
Jump to:  



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
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.