1 / 36

WMQ V7 Pub/Sub Introduction

WMQ V7 Pub/Sub Introduction. 李慧 lihui@cn.ibm.com IBM CDL MQ L2 support , April 2011. Agenda. Pub/Sub concept MQ V7 PUB/SUB new feature Pub/Sub adminstration Pub/Sub Programming MQ distributed Pub/Sub topology.

fox
Download Presentation

WMQ V7 Pub/Sub Introduction

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. WMQ V7 Pub/Sub Introduction 李慧 lihui@cn.ibm.com IBM CDL MQ L2 support , April 2011

  2. Agenda • Pub/Sub concept • MQ V7 PUB/SUB new feature • Pub/Sub adminstration • Pub/Sub Programming • MQ distributed Pub/Sub topology

  3. What is Publish/Subscribe ? 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 informationneed have no knowledgeof consumers • consumers of informationneed have no knowledgeof providers • new providers/consumers can be added without disruption • Providers of information are called publishers • Consumers of information are called subscribers

  4. 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 The classic example StockFeed Traders

  5. Loose-coupling with Publish/Subscribe Topic Few-to-many: Research, news tickers Topic Many-to-many: Prices and Quotes Topic Many-to-few: Orders

  6. 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 • 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. Web 2.0 Java Message Service (JMS) Multi-Language Message Service MQ Interface IBM WebSphere MQ V7.0 Publish Subscribe WebSphere MQ v7 Pub/Sub MQRFH to pub and sub? • Compatibility mode available in V7,embedded pub/sub engine • Now available on z/OS!and better performance on distributed platforms • Improved Pub/Sub adminstration • A natural part of the JMS API • Combines both Publish/Subscribe and Point-to-Point patterns • Now also a natural part of the native MQI v6 MQPUT + MQSUB! v7

  8. Publish/Subscribe in WebSphere MQ Monitor Configure Topic Status Create TOPIC objects Display Connectionsand handles Configure attributes Topic Tree MQSUB ‘Price/Fruit/+’ MQGET MQOPEN ‘Price/Fruit/Apples’ MQPUT Interface

  9. Topic strings and topic tree Price Fruit Vegetables Apples Oranges Potatoes Onions Price/Fruit/Apples Price/Fruit/Oranges Price/Vegetables/Potatoes Price/Vegetables/Onions

  10. 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

  11. Defining a topic object SYSTEM.BASE.TOPIC DEFINE TOPIC ALTER TOPIC DELETE TOPIC DISPLAY TOPIC Price FRUIT Fruit 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( ) Apples Oranges

  12. 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(ALLDUR) NPMSGDLV(ALLAVAIL) RETAINED(NO) PUBCOUNT(0) SUBCOUNT(0) PUBSCOPE(ALL) SUBSCOPE(ALL) Resolving ASPARENT DISPLAY TPSTATUS Price FRUIT Fruit Apples Oranges

  13. Alias Queues Price Starting MQSC for queue manager TEST1. DEFINE TOPIC(APPLES) TOPICSTR(‘Price/Fruit/Apples’) DEFINE QALIAS(PRICES) TARGTYPE(TOPIC) TARGET(APPLES) Fruit APPLES Apples Oranges MQPUT (PRICES) PRICES

  14. Administration for Publishers TOPIC attributes DEFPRTYDEFPSISTDEFPRESPPUBPUBSCOPEPMSGDLVNPMSGDLV Price Connection ID links to DISPLAY CONN FRUIT Fruit Starting MQSC for queue manager TEST1. DIS TPSTATUS('Price/Fruit/+') TYPE(PUB) allAMQ8754: 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) Apples Oranges MQOPEN ‘Price/Fruit/Apples’ MQPUT MQOPEN ‘Price/Fruit/Oranges’ MQPUT MQPUT MQPUT

  15. FULL Configuring Behaviour on Failure TOPIC attributes PMSGDLVNPMSGDLV TOPIC attribute defaults PMSGDLV (ALLDUR)NPMSGDLV (ALLAVAIL) MQSUB ‘Price/Fruit/+’ MQGET MQSUB ‘Price/Fruit/+’ MQGET MQOPEN ‘Price/Fruit/Apples’ MQPUT MQSUB ‘Price/Fruit/+’ MQSO_ DURABLE MQGET MQRC_PUBLICATION_FAILURE

  16. Creating administrative subscriptions Price Starting MQSC for queue manager TEST1. DEFINE SUB(APPLES.TO.Q1) TOPICSTR(‘Price/Fruit/Apples’) DEST(Q1) FRUIT Fruit Apples Oranges DEFINE SUB ALTER SUB DELETE SUB DISPLAY SUB MQGET (Q1)

  17. Starting MQSC for queue manager TEST1. DIS SUB(*) AMQ8096: WebSphere MQ subscription inquired. SUBID(414D5120544553543120202020202020832AC44720028105) SUB(Fruit Prices) TOPICSTR(Price/Fruit/+) DEST(SYSTEM.MANAGED.DURABLE.47C42A8304810220) DESTQMGR(TEST1) DESTCLAS(MANAGED) DURABLE(YES) SUBTYPE(API) Configuring managed destinations SYSTEM.BASE.TOPIC Durable Model DEFTYPE(PERMDYN) TOPIC attributes MDURMDL(SYSTEM.DURABLE.MODEL.QUEUE)MNDURMDL(SYSTEM.NDURABLE.MODEL.QUEUE) Non-durable Model DEFTYPE(TEMPDYN) Price FRUIT Fruit Apples Oranges MQSUB ‘Price/Fruit/+’ MQSO_MANAGED MQSO_DURABLE MQGET SYSTEM.MANAGED.DURABLE.47C42A83095D0220

  18. Displaying a subscription MQSD.SubName MQSD.ObjectName MQSD.ObjectString MQSO_WILDCARD_CHAR MQSO_WILDCARD_TOPIC MQSO_MANAGED or not MQSUB hObj parameter MQSD.SubCorrelId MQSO_DURABLE or not MQSD.SubUserData MQSD.SelectionString

  19. 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) Monitoring your Application subscriptions TOPIC attributes DURSUBSUBSUBSCOPEPROXYSUBWILDCARD Connection ID links to DISPLAY CONN Subscription ID links to DISPLAY SBSTATUSandDISPLAY SUB Price FRUIT Fruit Oranges Apples MQSUB ‘Price/Fruit/+’ MQGET

  20. Subscriptions – two perspectives Price FRUIT Fruit DIS TPSTATUS('Price/Fruit/+') TYPE(SUB) ALLAMQ8754: Display topic status details. TOPICSTR(Price/Fruit/Oranges) SUBID(414D5120544553543120202020202020832AC44720013D07) SUBUSER(hughson) DURABLE(NO) ACTCONN(414D5143544553543120202020202020832AC44720013D05) NUMMSGS(2) SUBTYPE(API) DIS SBSTATUS SUBID(414D5120544553543120202020202020832AC44720AMQ8099: WebSphere MQ subscription status inquired. SUB(Fruit Prices) SUBID(414D5120544553543120202020202020832AC44720013D07) SUBUSER(hughson) ACTCONN(414D5143544553543120202020202020832AC44720013D05) DURABLE(NO) NUMMSGS(5) SUBTYPE(API) Apples Oranges MQSUB ‘Price/Fruit/+’ MQGET

  21. PUB/SUB API • PUB application • Topic Tree isolation • SUB application • Subscription operation options • Advanced task

  22. OpnOpts = MQOO_OUTPUT | MQOO_FAIL_IF_QUIESCING; MQOPEN( hConn, &ObjDesc, OpnOpts, &hObj, &CompCode, &Reason); MQPUT ( hConn, hObj, &MsgDesc, &pmo, strlen(pBuffer), pBuffer, &CompCode, &Reason); MQOD ObjDesc = {MQOD_DEFAULT}; ObjDesc.ObjectType = MQOT_TOPIC; ObjDesc.Version = MQOD_VERSION_4; ObjDesc.ObjectString.VSPtr = “Price/Fruit/Apples”; ObjDesc.ObjectString.VSLength = MQVS_NULL_TERMINATED; Publishing Application • MQOPEN a topic • MQOD describes a topic to publish to • ObjectType • MQOT_Q for point-to-point • MQOT_TOPIC for publish • ObjectString/ObjectName • MQPUT a message

  23. Market Stalls Starting MQSC for queue manager TEST1. Hursley Discount Price Price strncpy(ObjDesc.ObjectName, “FRUIT.ANCHOR”, MQ_TOPIC_NAME_LENGTH); ObjDesc.ObjectString.VSPtr = “Apples”; ObjDesc.ObjectString.VSLength = MQVS_NULL_TERMINATED; Topic tree isolation DEFINE TOPIC(FRUIT.ANCHOR) TOPICSTR(‘Price/Fruit’) DEFINE TOPIC(FRUIT.ANCHOR) TOPICSTR(‘Market Stalls/Hursley/Discount/Price/Fruit’) FRUIT.ANCHOR Fruit Apples Oranges ?

  24. MQSUB ( hConn, &SubDesc, &hObj, &hSub, &CompCode, &Reason); MQGET ( hConn, hObj, &MsgDesc, &gmo, strlen(pBuffer), pBuffer, &DataLength, &CompCode, &Reason); MQSD SubDesc = {MQSD_DEFAULT}; SubDesc.ObjectString.VSPtr = “Price/Fruit/Apples”; SubDesc.ObjectString.VSLength = MQVS_NULL_TERMINATED; SubDesc.Options = MQSO_CREATE | MQSO_MANAGED | MQSO_FAIL_IF_QUIESCING; Subscribing Application • MQSUB verb • Subscription Descriptor (MQSD) describes the topic • MQSD.ObjectString • MQSD.ObjectName • Consume publications from the returned hObj • when MQSO_MANAGED used

  25. Subscription operation options • Operation – choose at least one of • MQSO_CREATE • MQSO_RESUME • MQSO_ALTER • Combining them • MQSO_CREATE + MQSO_RESUME • Avoids MQRC_SUB_ALREADY_EXISTS • MQSO_CREATE + MQSO_ALTER

  26. Advanced tasks • Durable subscriptions • Subscription destinations • Wildcards • Subscription expiration • Publication Selection • Retained Publications • Security on the API • Publication Contents • Selection of specific publications

  27. Publish/Subscribe Topologies • WMQ V6 publish/subscribe networks based on hierarchies • All brokers linked in parent/child tree • WMB publish/subscribe networks based on hierarchies of collectives • All systems in a collective are connected to each other (mesh) • Also has "clones" • New product built on hierarchies and clusters • With interoperability to other pub/sub systems through hierarchies • Clusters are built on existing WMQ cluster technology • Cluster can be defined independently of any existing cluster used for queuing • Behaves in a similar way to WMB collective • Design gives • Scalability • Availability • Ease of administration

  28. Hierarchies • Similar to WMQ v6 hierarchies • Interoperable with them • Very scalable • Network split if middle qmgr fails • Highly available hub and spokes • Definitions • QMB – ALTER QMGR PARENT(QMA) • QMC – ALTER QMGR PARENT(QMA) • QMD – ALTER QMGR PARENT(QMC) • No child attribute specified on parent • Channels must exist • Transmit queues of same name as remote queue manager • Uses TOPIC objects • No cluster topics required • Be careful using clusters as hierarchy transport • ALTER QMGR PSMODE(ENABLED) PSUB QMB QMA PSUB QMA QMC QMB SUB(/global/sports/*) PSUB QMC QMD PUB(/global/sports/football/news)

  29. Pub/Sub Clusters • Similar to WebSphere Message Broker Collectives • Availability – Direct links between qmgrs • Benefits of traditional clusters • Simplified administration • Useful for Pub/Sub Clusters • Non-disruptive add/remove of qmgrs • Workload balancing • NOT useful for Pub/Sub Clusters • Cluster channels • Same CLUSSDR/CLUSRCVR model • Flexible connectivity • All to all connectivity • Overlapping clusters • No Pub/Sub through gateway queue managers • Use Hierarchies for linking Pub/Sub Clusters • Cluster topics • Required for publishing to remote Pub/Sub Cluster queue managers • Cluster queues • Can be used in traditional way in a Pub/Sub Cluster PUB SUB SUB SUB

  30. Publish/Subscribe in Combined Hierarchy & Clusters QM QM QM QM QM QM QM QM QM QM QM QM QM

  31. New Feature Pub/Sub engine Avaiable on zos Enhanced Admin Native MQ pub/sub API ADMIN Topic string/Topic Tree Topic,Subsription object Dis tpstatus, Dis conn Topology Hierarchies Cluster Summary – Pub/Sub with WebSphere MQ V7 • Concept • What’s pub/sub • API • Pub application • Topic tree isolation • Sub application

  32. More Information about Pub/Sub • Info center: Publish⁄Subscribe User's Guide • Developerwork article: http://www.ibm.com/developerworks/cn/websphere/library/techarticles/0904_xuran_mq/

  33. Candidate topics survey for year 2011 MQ MQ Introduction MQ Cluster Deploy & running MQ client on WAS. WAS Advanced security configuration Enhanced Admin Session management Data source and connection pooling OpenMic session introduction / Survey • Frequency: Bi-Monthly • Products: • WebSphere MQ • WebSphere Message Broker • WebSphere Application Server

  34. Q & A

More Related