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 Java / JMS » Publish and SubScribe

Post new topic  Reply to topic Goto page 1, 2, 3  Next
 Publish and SubScribe « View previous topic :: View next topic » 
Author Message
masteringmq
PostPosted: Thu Oct 30, 2008 9:50 pm    Post subject: Publish and SubScribe Reply with quote

Master

Joined: 20 Oct 2008
Posts: 200

I was reading about the publish and subscribe model and after thinking about it how does a publish and subscribe model work. Take an example of stock quote where investors can subscribe to receive daily stock quote. The stock quote changes base on the market condition. So the stock market will publish this information and who ever is interested to receive the information can subscribe. Now lets say I subscribe to NYSE. So there is a local queue called StockMarket that holds the names of all the stock market and one of them is NYSE. Now I grab this information from the queue and display it on a combo box in my java application. Then I click next and it takes me to screen that requires me to input personal information to subscribe to NYSE. So I type all the information and click submit, which will generate a messsage and route it to the database. Then I receive an acknowledgement message stating that the subscription is completed. Now the stock queue holds all the stock quote. How will my application know which stock quote is related to NYSE and that is what my application should grab?. Do I create a seperate StockQuote queue for different stock market?. Example: StockQuoteNYSE - NYSE, StockQuoteNYMEX - NYMES?.
Back to top
View user's profile Send private message
elvis_gn
PostPosted: Thu Oct 30, 2008 10:09 pm    Post subject: Reply with quote

Padawan

Joined: 08 Oct 2004
Posts: 1905
Location: Dubai

Hi masteringmq,

Look at the 'Topic based subscription' concept.

Regards.
Back to top
View user's profile Send private message Send e-mail
masteringmq
PostPosted: Thu Oct 30, 2008 10:14 pm    Post subject: Reply with quote

Master

Joined: 20 Oct 2008
Posts: 200

Solution: GroupID
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Fri Oct 31, 2008 3:15 am    Post subject: Reply with quote

Grand High Poobah

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

masteringmq wrote:
Solution: GroupID


I doubt it very much. Look at elvis_gn's post. Topic strings is the way to go.

Have fun.
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
masteringmq
PostPosted: Fri Oct 31, 2008 8:45 pm    Post subject: Reply with quote

Master

Joined: 20 Oct 2008
Posts: 200

From a database point of view:

Table: StockQuote
Fields: StockQuoteID (PK), StockName, Price, GroupID(FK)

Table: StockMarket
Fields: GroupID (PK), StockMarketName

Table: Registration
Fields: RegID, Name......,GroupID (FK)

why is it not possible?. Please advice.

Please note, PK - Primary Key, FK - Foreign Key
Back to top
View user's profile Send private message
elvis_gn
PostPosted: Fri Oct 31, 2008 9:54 pm    Post subject: Reply with quote

Padawan

Joined: 08 Oct 2004
Posts: 1905
Location: Dubai

Hi masteringmq,

Are you trying to say that you will have a Primary-Foreign key relationship between all the messages on your queue and pick accordingly ?

If yes, then imagine that your application will have to browse all messages every time looking for matching or related messages, it is not like a database where a SELECT with WHERE will internally look through all rows...here you will have to explicitly move the cursor and check every message...a very costly affair.

MQ does not work like a database.

Regards.
Back to top
View user's profile Send private message Send e-mail
masteringmq
PostPosted: Fri Oct 31, 2008 10:08 pm    Post subject: Reply with quote

Master

Joined: 20 Oct 2008
Posts: 200

So how do I see things from an MQ point of view? Please advice.

Quote:
Topic strings is the way to go.


Please advice.

Quote:
application will have to browse all messages every time looking for matching or related messages


In this case, I have one message that will carry all the information?. One message contains all the stock quote traded in a StockMarket. So the subscriber will subscribe to it. The structure of the message:

Topic: NYSE
Content: StockQuotes

From a Java point of view I can encapsulate this data as an object. The object can be a vector for example.

Issue:

Receiving app will still have to browse through all the messages. Reason to know which is NYSE. This would mean the messageID will be NYSE. Please advice.

If the message is retrieved by the receiving app, it no longer sits in the local queue. How will other subscribers get the data?. Please advice.
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Sat Nov 01, 2008 4:36 am    Post subject: Reply with quote

Grand High Poobah

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

You need a topic tree, like:

Stock/Quotes/NYSE/IBM (name or ticker)
Stock/Quotes/contact admin/SAP .....

You will publish with the actual stock name.
You may subscribe generically
Stock/Quotes/NYSE/#

And the subscription topic should contain the target queue like
topic://Stock/Quotes/NYSE/#?.....JMS/ND/MYQUEUE....

For exact syntax use rfhutil and send to a dummy queue to inspect

There is an excellent pub/sub manual at the library link at the top of the page
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
masteringmq
PostPosted: Sat Nov 01, 2008 9:12 am    Post subject: Reply with quote

Master

Joined: 20 Oct 2008
Posts: 200

Quote:
Topic strings is the way to go


How does the below differ?

- Topic Name
- Topic String

Slide says,

- Topic Name = Sports, News, Cricket, Rugby
- Topic String = Sports/Cricket/West Indies (48 Character String)

Please advice.
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Sun Nov 02, 2008 12:36 pm    Post subject: Reply with quote

Grand High Poobah

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

masteringmq wrote:
Quote:
Topic strings is the way to go


How does the below differ?

- Topic Name
- Topic String

Slide says,

- Topic Name = Sports, News, Cricket, Rugby
- Topic String = Sports/Cricket/West Indies (48 Character String)

Please advice.

Look up your documentation. There are significant differences between version 6 and version 7. Going to the Library link at the top of the page will allow you to navigate to both versions of the doc...
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
masteringmq
PostPosted: Mon Nov 03, 2008 6:13 pm    Post subject: Reply with quote

Master

Joined: 20 Oct 2008
Posts: 200

With the use of MQ 6 alone and without WMQ, can I implement the publish and subscribe model?. I saw a simple publish and subscribe model that uses a single broker. So the publisher will publish to the broker and the subscriber will subscribe to the topic in the broker. Can a queue manager function as the broker instead?.
Back to top
View user's profile Send private message
mvic
PostPosted: Mon Nov 03, 2008 6:30 pm    Post subject: Reply with quote

Jedi

Joined: 09 Mar 2004
Posts: 2080

masteringmq wrote:
With the use of MQ 6 alone and without WMQ, can I implement the publish and subscribe model?. I saw a simple publish and subscribe model that uses a single broker. So the publisher will publish to the broker and the subscriber will subscribe to the topic in the broker. Can a queue manager function as the broker instead?.

You can do publish / subscribe messaging model with either MQ v6 or MQ v7. What do you actually want to achieve and how will your applications be written (incl. what language?)
Back to top
View user's profile Send private message
masteringmq
PostPosted: Mon Nov 03, 2008 6:41 pm    Post subject: Reply with quote

Master

Joined: 20 Oct 2008
Posts: 200

Quote:
how will your applications be written (incl. what language?)


The app will be written using Java language with MQ classes.

Quote:
What do you actually want to achieve


To publish stock details so that people can subscribe to the information.
Back to top
View user's profile Send private message
mvic
PostPosted: Mon Nov 03, 2008 6:50 pm    Post subject: Reply with quote

Jedi

Joined: 09 Mar 2004
Posts: 2080

masteringmq wrote:
Quote:
What do you actually want to achieve


To publish stock details so that people can subscribe to the information.

Check out the WebSphere MQ Using Java manual in the section about pub/sub. If using MQ v7, check out the Publish/Subscribe manual too.
Back to top
View user's profile Send private message
masteringmq
PostPosted: Mon Nov 03, 2008 9:29 pm    Post subject: Reply with quote

Master

Joined: 20 Oct 2008
Posts: 200

I found a JMS code for pub/sub. But I cant find any for MQ Java.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Goto page 1, 2, 3  Next Page 1 of 3

MQSeries.net Forum Index » IBM MQ Java / JMS » Publish and SubScribe
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.