More Related Content
Similar to WM2011G19.pdf (20)
WM2011G19.pdf
- 1. Course materials may not be reproduced in whole or in part without the prior written permission of IBM. 5.1.0.1
© Copyright IBM Corporation 2008
Introduction to IBM WebSphere MQ
publish/subscribe
- 2. © Copyright IBM Corporation 2008
Unit objectives
After completing this unit, you should be able to:
• Explain how WebSphere MQ supports a publish/subscribe
environment
• Describe how to create the objects required in an MQ
publish/subscribe environment
• Explain the merits of publish/subscribe versus point-to-point
messaging
• Design a publish/subscribe system incorporating multiple
queue managers
• Use utilities to manage and monitor topics, publications, and
subscriptions
- 3. © Copyright IBM Corporation 2008
What is publish/subscribe?
• Providers of information
need have no knowledge
of consumers
• Consumers of information
need have no knowledge
of providers
• New providers/consumers can
be added without disruption
Publish/subscribe is a term used to define an
application model in which the provider of
some information is decoupled from the
consumers of that information.
• Providers of information
are called publishers
• Consumers of
information are called
subscribers
- 4. © Copyright IBM Corporation 2008
The classic example
• A "feed" provides a continuous flow
of information which is pushed to
interested parties
• Traders consume this information
and use it as a basis for the buying
and selling stock
Traders
Stock
Feed
- 5. © Copyright IBM Corporation 2008
Loose-coupling with publish/subscribe
Few-to-many: Research, news tickers
Many-to-many: Prices and quotes
Many-to-few: Orders
Topic
Topic
Topic
- 6. © Copyright IBM Corporation 2008
Publications and subscriptions
• Subscribers make subscriptions with the queue
manager to register their interest in information relating
to specific topics.
– They use the MQSUB verb
– Or define using DEFINE SUB command
• Publishers provide information about specific topics by
sending publications to the queue manager
– They use the MQPUT verb
• The queue manager forwards each publication it
receives to all subscribers with a subscription which
matches the associated topic
- 7. © Copyright IBM Corporation 2008
Publish/subscribe in IBM WebSphere MQ
Configure
M
onitor
Interface
Create TOPIC objects
Topic status
Display connections
and handles
Configure attributes
Topic Tree
MQSUB
‘Price/Fruit/+’
MQGET
MQOPEN
‘Price/Fruit/Apples’
MQPUT
- 8. © Copyright IBM Corporation 2008
Topic strings and topic tree
Price/Fruit/Apples
Price/Fruit/Oranges
Price/Vegetables/Potatoes
Price/Vegetables/Onions
Price
Fruit
Apples Oranges
Vegetables
Potatoes Onions
Topic strings
Topic tree
- 9. © Copyright IBM Corporation 2008
Topic objects
• Not necessary for publish/subscribe
• Provide an administrative control point for your topic tree
– Configuration attributes
– Security profiles
– Topic tree isolation
MY.TOPIC.OBJECT
- 10. © Copyright IBM Corporation 2008
Base topic object
Price
Fruit
Apples Oranges
Vegetables
Potatoes Onions
SYSTEM.BASE.TOPIC
- 11. © Copyright IBM Corporation 2008
Defining a topic object (1 of 2)
Price
Fruit
Apples Oranges
SYSTEM.BASE.TOPIC
Starting MQSC for queue manager TEST1.
DEFINE TOPIC(FRUIT)
TOPICSTR(‘Price/Fruit’) DURSUB(NO)
DISPLAY TOPIC(FRUIT)
AMQ8633: Display topic details.
TOPIC(FRUIT) TYPE(LOCAL)
TOPICSTR(Price/Fruit) DESCR( )
CLUSTER( ) DURSUB(NO)
PUB(ASPARENT) SUB(ASPARENT)
DEFPSIST(ASPARENT) DEFPRTY(ASPARENT)
DEFPRESP(ASPARENT) ALTDATE(2008-02-26)
ALTTIME(15.05.22) PMSGDLV(ASPARENT)
NPMSGDLV(ASPARENT) PUBSCOPE(ASPARENT)
SUBSCOPE(ASPARENT) PROXYSUB(FIRSTUSE)
WILDCARD(PASSTHRU) MDURMDL( )
MNDURMDL( )
DEFINE TOPIC
ALTER TOPIC
DELETE TOPIC
DISPLAY TOPIC
FRUIT
Note: the next screen provides a
closer view of this command prompt.
- 12. © Copyright IBM Corporation 2008
Defining a topic object (2 of 2)
Starting MQSC for queue manager TEST1.
DEFINE TOPIC(FRUIT)
TOPICSTR(‘Price/Fruit’) DURSUB(NO)
DISPLAY TOPIC(FRUIT)
AMQ8633: Display topic details.
TOPIC(FRUIT) TYPE(LOCAL)
TOPICSTR(Price/Fruit) DESCR( )
CLUSTER( ) DURSUB(NO)
PUB(ASPARENT) SUB(ASPARENT)
DEFPSIST(ASPARENT) DEFPRTY(ASPARENT)
DEFPRESP(ASPARENT) ALTDATE(2008-02-26)
ALTTIME(15.05.22) PMSGDLV(ASPARENT)
NPMSGDLV(ASPARENT) PUBSCOPE(ASPARENT)
SUBSCOPE(ASPARENT) PROXYSUB(FIRSTUSE)
WILDCARD(PASSTHRU) MDURMDL( )
MNDURMDL( )
- 13. © Copyright IBM Corporation 2008
DEFINE TOPIC command
DEFINE TOPIC(FRUIT)
TOPICSTR(‘Price/Fruit’) DURSUB(NO)
DISPLAY TOPIC(FRUIT)
AMQ8633: Display topic details.
TOPIC(FRUIT) TYPE(LOCAL)
TOPICSTR(Price/Fruit) DESCR( )
CLUSTER( ) DURSUB(NO)
PUB(ASPARENT) SUB(ASPARENT)
DEFPSIST(ASPARENT) DEFPRTY(ASPARENT)
DEFPRESP(ASPARENT) ALTDATE(2008-02-26)
ALTTIME(15.05.22) PMSGDLV(ASPARENT)
NPMSGDLV(ASPARENT) PUBSCOPE(ASPARENT)
SUBSCOPE(ASPARENT) PROXYSUB(FIRSTUSE)
WILDCARD(PASSTHRU) MDURMDL( )
MNDURMDL( )
- 14. © Copyright IBM Corporation 2008
Defining a topic using IBM WebSphere MQ Explorer (1
of 11)
- 15. © Copyright IBM Corporation 2008
Defining a topic using IBM WebSphere MQ Explorer (2
of 11)
- 16. © Copyright IBM Corporation 2008
Defining a topic using IBM WebSphere MQ Explorer (3
of 11)
- 17. © Copyright IBM Corporation 2008
Defining a topic using IBM WebSphere MQ Explorer (4
of 11)
- 18. © Copyright IBM Corporation 2008
Defining a topic using IBM WebSphere MQ Explorer (5
of 11)
- 19. © Copyright IBM Corporation 2008
Defining a topic using IBM WebSphere MQ Explorer (6
of 11)
- 20. © Copyright IBM Corporation 2008
Defining a topic using IBM WebSphere MQ Explorer (7
of 11)
- 21. © Copyright IBM Corporation 2008
Defining a topic using IBM WebSphere MQ Explorer (8
of 11)
- 22. © Copyright IBM Corporation 2008
Defining a topic using IBM WebSphere MQ Explorer (9
of 11)
- 23. © Copyright IBM Corporation 2008
Defining a topic using IBM WebSphere MQ Explorer (10
of 11)
- 24. © Copyright IBM Corporation 2008
Defining a topic using IBM WebSphere MQ Explorer (11
of 11)
- 25. © Copyright IBM Corporation 2008
Resolving ASPARENT
Price
Fruit
Apples Oranges
Starting MQSC for queue manager TEST1.
DIS TPSTATUS(‘Price/Fruit’)
AMQ8754: Display topic status details.
TOPICSTR(Price/Fruit) ADMIN(FRUIT)
MDURMDL(SYSTEM.DURABLE.MODEL.QUEUE)
MNDURMDL(SYSTEM.NDURABLE.MODEL.QUEUE)
DEFPSIST(NO) DEFPRTY(0)
DEFPRESP(SYNC) DURSUB(NO)
PUB(ENABLED) SUB(ENABLED)
PMSGDLV(ALLDU NPMSGDLV(ALLAVAIL)
RETAINED(NO) PUBCOUNT(0)
SUBCOUNT(0) PUBSCOPE(ALL)
SUBSCOPE(ALL)
DISPLAY TPSTATUS
FRUIT
- 26. © Copyright IBM Corporation 2008
Using MQ Explorer for topic status (1 of 5)
- 27. © Copyright IBM Corporation 2008
Using MQ Explorer for topic status (2 of 5)
- 28. © Copyright IBM Corporation 2008
Using MQ Explorer for topic status (3 of 5)
- 29. © Copyright IBM Corporation 2008
Using MQ Explorer for topic status (4 of 5)
- 30. © Copyright IBM Corporation 2008
Using MQ Explorer for topic status (5 of 5)
- 31. © Copyright IBM Corporation 2008
FRUIT
Administration for publishers (1 of 2)
Price
Fruit
Apples Oranges
Starting MQSC for queue manager TEST1.
DIS TPSTATUS('Price/Fruit/+') TYPE(PUB) all
AMQ8754: Display topic status details.
TOPICSTR(Price/Fruit/Oranges) LPUBDATE(2008-02-26)
LPUBTIME(16:50:44)
ACTCONN(414D5143544553543120202020202020832AC44720005E02)
NUMPUBS(3)
AMQ8754: Display topic status details.
TOPICSTR(Price/Fruit/Apples) LPUBDATE(2008-02-26)
LPUBTIME(16:50:37)
ACTCONN(414D5143544553543120202020202020832AC44720007601)
NUMPUBS(1)
TOPIC attributes
DEFPRTY
DEFPSIST
DEFPRESP
PUB
PUBSCOPE
PMSGDLV
NPMSGDLV
MQOPEN
‘Price/Fruit/Apples’
MQPUT
MQOPEN
‘Price/Fruit/Oranges’
MQPUT
MQPUT
MQPUT
Connection ID links to
DISPLAY CONN
Note: the next screen provides a
closer view of this command prompt.
- 32. © Copyright IBM Corporation 2008
Administration for publishers (2 of 2)
Starting MQSC for queue manager TEST1.
DIS TPSTATUS('Price/Fruit/+') TYPE(PUB) all
AMQ8754: Display topic status details.
TOPICSTR(Price/Fruit/Oranges) LPUBDATE(2008-02-26)
LPUBTIME(16:50:44)
ACTCONN(414D5143544553543120202020202020832AC44720005E02)
NUMPUBS(3)
AMQ8754: Display topic status details.
TOPICSTR(Price/Fruit/Apples) LPUBDATE(2008-02-26)
LPUBTIME(16:50:37)
ACTCONN(414D5143544553543120202020202020832AC44720007601)
NUMPUBS(1)
- 33. © Copyright IBM Corporation 2008
Topic status display for publishers
DIS TPSTATUS('Price/Fruit/+') TYPE(PUB) all
AMQ8754: Display topic status details.
TOPICSTR(Price/Fruit/Oranges) LPUBDATE(2008-02-26)
LPUBTIME(16:50:44)
ACTCONN(414D5143544553543120202020202020832AC44720005E02)
NUMPUBS(3)
AMQ8754: Display topic status details.
TOPICSTR(Price/Fruit/Apples) LPUBDATE(2008-02-26)
LPUBTIME(16:50:37)
ACTCONN(414D5143544553543120202020202020832AC44720007601)
NUMPUBS(1)
DIS CONN(832AC44720007601) TYPE(ALL)
AMQ8276: Display Connection details.
CONN(832AC44720007601)
EXTCONN(414D5143544553543120202020202020)
TYPE(CONN)
APPLTAG(D:q.exe) APPLTYPE(USER)
USERID(hughson)
OBJNAME( ) OBJTYPE(TOPIC)
OPENOPTS(MQOO_OUTPUT,MQOO_FAIL_IF_QUIESCING)
TOPICSTR(Price/Fruit/Apples)
DIS TPSTATUS('Price/Fruit/+') TYPE(PUB) all
AMQ8754: Display topic status details.
TOPICSTR(Price/Fruit/Oranges) LPUBDATE(2008-02-26)
LPUBTIME(16:50:44)
ACTCONN(414D5143544553543120202020202020832AC44720005E02)
NUMPUBS(3)
AMQ8754: Display topic status details.
TOPICSTR(Price/Fruit/Apples) LPUBDATE(2008-02-26)
LPUBTIME(16:50:37)
ACTCONN(414D5143544553543120202020202020832AC44720007601)
NUMPUBS(1)
DIS CONN(832AC44720007601) TYPE(ALL)
AMQ8276: Display Connection details.
CONN(832AC44720007601)
EXTCONN(414D5143544553543120202020202020)
TYPE(CONN)
APPLTAG(D:q.exe) APPLTYPE(USER)
USERID(hughson)
OBJNAME( ) OBJTYPE(TOPIC)
OPENOPTS(MQOO_OUTPUT,MQOO_FAIL_IF_QUIESCING)
TOPICSTR(Price/Fruit/Apples)
- 34. © Copyright IBM Corporation 2008
Displaying publisher topic status using MQ Explorer (1
of 3)
- 35. © Copyright IBM Corporation 2008
Displaying publisher topic status using MQ Explorer (2
of 3)
- 36. © Copyright IBM Corporation 2008
Displaying publisher topic status using MQ Explorer (3
of 3)
- 37. © Copyright IBM Corporation 2008
Creating administrative subscriptions
FRUIT
Price
Fruit
Apples Oranges
Starting MQSC for queue manager TEST1.
DEFINE SUB(APPLES.TO.Q1)
TOPICSTR(‘Price/Fruit/Apples’)
DEST(Q1)
MQGET
(Q1)
DEFINE SUB
ALTER SUB
DELETE SUB
DISPLAY SUB
- 38. © Copyright IBM Corporation 2008
Monitoring application subscriptions (1 of 2)
Price
Fruit
Apples Oranges
DIS TPSTATUS('Price/Fruit/+') TYPE(SUB) ALL
AMQ8754: Display topic status details.
TOPICSTR(Price/Fruit/Oranges)
SUBID(414D5120544553543120202020202020832AC44720013D07)
SUBUSER(hughson) RESMDATE(2008-02-26)
RESMTIME(18:53:35) LMSGDATE(2008-02-26)
LMSGTIME(18:53:41) DURABLE(NO)
ACTCONN(414D5143544553543120202020202020832AC44720013D05)
NUMMSGS(2) SUBTYPE(API)
AMQ8754: Display topic status details.
TOPICSTR(Price/Fruit/Apples)
SUBID(414D5120544553543120202020202020832AC44720013D07)
SUBUSER(hughson) RESMDATE(2008-02-26)
RESMTIME(18:53:35) LMSGDATE(2008-02-26)
LMSGTIME(18:53:41) DURABLE(NO)
ACTCONN(414D5143544553543120202020202020832AC44720013D05)
NUMMSGS(2) SUBTYPE(API)
MQSUB
‘Price/Fruit/+’
MQGET
Connection ID links to
DISPLAY CONN
Subscription ID links to
DISPLAY SBSTATUS
and
DISPLAY SUB
TOPIC attributes
DURSUB
SUB
SUBSCOPE
PROXYSUB
WILDCARD
FRUIT
Note: the next screen provides a
closer view of this command prompt.
- 39. © Copyright IBM Corporation 2008
Monitoring application subscriptions (2 of 2)
DIS TPSTATUS('Price/Fruit/+') TYPE(SUB) ALL
AMQ8754: Display topic status details.
TOPICSTR(Price/Fruit/Oranges)
SUBID(414D5120544553543120202020202020832AC44720013D07)
SUBUSER(hughson) RESMDATE(2008-02-26)
RESMTIME(18:53:35) LMSGDATE(2008-02-26)
LMSGTIME(18:53:41) DURABLE(NO)
ACTCONN(414D5143544553543120202020202020832AC44720013D05)
NUMMSGS(2) SUBTYPE(API)
AMQ8754: Display topic status details.
TOPICSTR(Price/Fruit/Apples)
SUBID(414D5120544553543120202020202020832AC44720013D07)
SUBUSER(hughson) RESMDATE(2008-02-26)
RESMTIME(18:53:35) LMSGDATE(2008-02-26)
LMSGTIME(18:53:41) DURABLE(NO)
ACTCONN(414D5143544553543120202020202020832AC44720013D05)
NUMMSGS(2) SUBTYPE(API)
- 40. © Copyright IBM Corporation 2008
Display subscriber topic status (1 of 3)
DIS TPSTATUS('Price/Fruit/+') TYPE(SUB) ALL
AMQ8754: Display topic status details.
TOPICSTR(Price/Fruit/Oranges)
SUBID(414D5120544553543120202020202020832AC44720013D07)
SUBUSER(hughson) RESMDATE(2008-02-26)
RESMTIME(18:53:35) LMSGDATE(2008-02-26)
LMSGTIME(18:53:41) DURABLE(NO)
ACTCONN(414D5143544553543120202020202020832AC44720013D05)
NUMMSGS(2) SUBTYPE(API)
AMQ8754: Display topic status details.
TOPICSTR(Price/Fruit/Apples)
SUBID(414D5120544553543120202020202020832AC44720013D07)
SUBUSER(hughson) RESMDATE(2008-02-26)
RESMTIME(18:53:35) LMSGDATE(2008-02-26)
LMSGTIME(18:53:41) DURABLE(NO)
ACTCONN(414D5143544553543120202020202020832AC44720013D05)
NUMMSGS(2) SUBTYPE(API)
- 41. © Copyright IBM Corporation 2008
DIS CONN(832AC44720013D05) TYPE(ALL)
AMQ8276: Display Connection details.
CONN(832AC44720016401)
EXTCONN(414D5143544553543120202020202020)
TYPE(CONN)
APPLTAG(D:q.exe) APPLTYPE(USER)
USERID(hughson)
OBJNAME(Q1) OBJTYPE(QUEUE)
OPENOPTS(MQOO_INPUT_SHARED,MQOO_FAIL_IF_QUIESCING)
OBJNAME( ) OBJTYPE(TOPIC)
DEST(Q1) DESTQMGR(TEST1)
SUBNAME(Fruit Prices)
SUBID(414D5120544553543120202020202020832AC44720016403)
TOPICSTR(Price/Fruit/+)
Display subscriber topic status (2 of 3)
- 42. © Copyright IBM Corporation 2008
DIS SBSTATUS SUBID(414D5120544553543120202020202020832AC44720013D07)
AMQ8099: WebSphere MQ subscription status inquired.
SUB(Fruit Prices)
SUBID(414D5120544553543120202020202020832AC44720013D07)
SUBUSER(hughson) RESMDATE(2008-02-26)
RESMTIME(19:10:07) LMSGDATE(2008-02-26)
LMSGTIME(19:10:28)
ACTCONN(414D5143544553543120202020202020832AC44720013D05)
DURABLE(NO) NUMMSGS(5)
SUBTYPE(API)
Display subscriber topic status (3 of 3)
- 43. © Copyright IBM Corporation 2008
Subscription information using MQ Explorer (1 of 3)
- 44. © Copyright IBM Corporation 2008
Subscription information using MQ Explorer (2 of 3)
- 45. © Copyright IBM Corporation 2008
Subscription information using MQ Explorer (3 of 3)
- 46. © Copyright IBM Corporation 2008
Checkpoint questions
1. True or false: A subscriber is an application that can only
make one subscription at a time to a topic on a particular
queue manager.
2. What are the two ways that a subscription is made by an
application?
3. In a TOPIC definition, what does the value ASPARENT
mean?
4. True or false: All values of a TOPIC object definition can be
altered using the ALTER TOPIC command.
5. What is the command used to show details of the current
publishers on a topic string?
- 47. © Copyright IBM Corporation 2008
Checkpoint solutions
1. True or false: A subscriber is an application that can only make one
subscription at a time to a topic on a particular queue manager.
– False, an application can make multiple subscriptions to the queue
manager for different topics
2. What are the two ways that a subscription is made by an application?
– DEFINE SUBSCRIPTION command, and MQSUB verb
3. In a TOPIC definition, what does the value ASPARENT mean?
– ASPARENT means that the value is based on the setting of the closest
parent administrative topic object in the topic tree.
4. True or false: All values of a TOPIC object definition can be altered
using the ALTER TOPIC command.
– False. The TOPICSTR value cannot be altered. The TOPIC object needs to
be deleted and redefined if this value needs to be changed.
5. What is the command used to show details of the current publishers
on a topic string?
– DISPLAY TPSTATUS TYPE(PUB)
- 48. © Copyright IBM Corporation 2008
Unit summary
Having completed this unit, you should be able to:
• Explain how WebSphere MQ supports a publish/subscribe
environment
• Describe how to create the objects required in an MQ
publish/subscribe environment
• Explain the merits of publish/subscribe versus point-to-point
messaging
• Design a publish/subscribe system incorporating multiple
queue managers
• Use utilities to manage and monitor topics, publications, and
subscriptions