+ All Categories
Home > Documents > An introduction to MQ Publish/Subscribe...Capitalware's MQ Technical Conference v2.0.1.6 An...

An introduction to MQ Publish/Subscribe...Capitalware's MQ Technical Conference v2.0.1.6 An...

Date post: 12-Aug-2020
Category:
Upload: others
View: 10 times
Download: 1 times
Share this document with a friend
47
Capitalware's MQ Technical Conference v2.0.1.6 An introduction to MQ Publish/Subscribe David Ware Lead Architect, IBM MQ Distributed [email protected] Recording available at: http:// www.slideshare.net/DavidWare1/ame-2271-mq- publish-subscribe-pdf
Transcript
Page 1: An introduction to MQ Publish/Subscribe...Capitalware's MQ Technical Conference v2.0.1.6 An introduction to MQ Publish/Subscribe David Ware Lead Architect, IBM MQ Distributed dware@uk.ibm.com

Capitalware's MQ Technical Conference v2.0.1.6

An introduction to MQ Publish/Subscribe

David WareLead Architect, IBM MQ [email protected]

Recording available at:http://www.slideshare.net/DavidWare1/ame-2271-mq-

publish-subscribe-pdf

Page 2: An introduction to MQ Publish/Subscribe...Capitalware's MQ Technical Conference v2.0.1.6 An introduction to MQ Publish/Subscribe David Ware Lead Architect, IBM MQ Distributed dware@uk.ibm.com

Capitalware's MQ Technical Conference v2.0.1.62© 2016 IBM Corporation

Agenda

Publish/Subscribe in IBM MQ

Administration of publish/subscribe

Management of publish/subscribe

Subscriptions and publications

Page 3: An introduction to MQ Publish/Subscribe...Capitalware's MQ Technical Conference v2.0.1.6 An introduction to MQ Publish/Subscribe David Ware Lead Architect, IBM MQ Distributed dware@uk.ibm.com

Capitalware's MQ Technical Conference v2.0.1.6

What is publish/subscribe?

Page 4: An introduction to MQ Publish/Subscribe...Capitalware's MQ Technical Conference v2.0.1.6 An introduction to MQ Publish/Subscribe David Ware Lead Architect, IBM MQ Distributed dware@uk.ibm.com

Capitalware's MQ Technical Conference v2.0.1.64© 2016 IBM Corporation

point-to-point

Message consumer

Message consumer

Message consumer

Message producer

How does it compare to point-to-point?

Page 5: An introduction to MQ Publish/Subscribe...Capitalware's MQ Technical Conference v2.0.1.6 An introduction to MQ Publish/Subscribe David Ware Lead Architect, IBM MQ Distributed dware@uk.ibm.com

Capitalware's MQ Technical Conference v2.0.1.65© 2016 IBM Corporation

point-to-point

Topic

Message consumer

Message consumer

Message consumer

Message producer

How does it compare to point-to-point?

publish/subscribeSubscription

Subscription

Subscription

Message consumer

Message consumer

Message consumer

Message producer

Page 6: An introduction to MQ Publish/Subscribe...Capitalware's MQ Technical Conference v2.0.1.6 An introduction to MQ Publish/Subscribe David Ware Lead Architect, IBM MQ Distributed dware@uk.ibm.com

Capitalware's MQ Technical Conference v2.0.1.66© 2016 IBM Corporation

But which subscriptions receive the messages?

Subscription

Subscription

Subscription

Subscription

Publisher

Publisher

Publisher

Subscription

Subscription

• Publishing and subscribing is based on ‘topics’

• Green messages go to green subscribers

• Orange messages go to orange subscribers

• But nobody wants a blue message!

Publisher

Page 7: An introduction to MQ Publish/Subscribe...Capitalware's MQ Technical Conference v2.0.1.6 An introduction to MQ Publish/Subscribe David Ware Lead Architect, IBM MQ Distributed dware@uk.ibm.com

Capitalware's MQ Technical Conference v2.0.1.6

Publish/Subscribe in

IBM MQ

Page 8: An introduction to MQ Publish/Subscribe...Capitalware's MQ Technical Conference v2.0.1.6 An introduction to MQ Publish/Subscribe David Ware Lead Architect, IBM MQ Distributed dware@uk.ibm.com

Capitalware's MQ Technical Conference v2.0.1.68© 2016 IBM Corporation

WebSphere MQ’s publish/subscribe over the years

WebSphere MQ Publish/Subscribe SupportPac MA0C

IBM Integration Bus® (formerly WebSphere Message Broker®)

WebSphere MQ

Command message based publish/subscribe API

JMS publish/subscribe API

Native MQI publish/subscribe API

Publish/Subscribe brokers

WebSphere MQ Publish/Subscribe APIs

XMS publish/subscribe API

MQ V 8MQ V 7MQ V 6MQ V 5.1 MQ V 9

Page 9: An introduction to MQ Publish/Subscribe...Capitalware's MQ Technical Conference v2.0.1.6 An introduction to MQ Publish/Subscribe David Ware Lead Architect, IBM MQ Distributed dware@uk.ibm.com

Capitalware's MQ Technical Conference v2.0.1.6

Topics

Page 10: An introduction to MQ Publish/Subscribe...Capitalware's MQ Technical Conference v2.0.1.6 An introduction to MQ Publish/Subscribe David Ware Lead Architect, IBM MQ Distributed dware@uk.ibm.com

Capitalware's MQ Technical Conference v2.0.1.612© 2016 IBM Corporation

It’s all about the topic tree

Price

Fruit

Apples Oranges

Vegetables

Potatoes

Topic string

Topic node

/Price/Fruit/Apples /Price/Fruit/Oranges /Price/Vegetables/Potatoes

Page 11: An introduction to MQ Publish/Subscribe...Capitalware's MQ Technical Conference v2.0.1.6 An introduction to MQ Publish/Subscribe David Ware Lead Architect, IBM MQ Distributed dware@uk.ibm.com

Capitalware's MQ Technical Conference v2.0.1.614© 2016 IBM Corporation

Price

Fruit

Apples Oranges

Subscription

/Price/Fruit/Oranges

•Subscriptions are attached to matching nodes in the topic tree

•Publications identify the relevant topic node

Publisher

/Price/Fruit/Oranges

•A copy of the publication is delivered to the queue identified by each matching subscription

Subscription

/Price/Fruit/Apples

Subscription

/Price/Fruit/Oranges

Subscription

/Price/Fruit/#

•Wildcarding subscriptions at the topic node level can receive messages from multiple topic strings

Matching publications to subscriptions

Page 12: An introduction to MQ Publish/Subscribe...Capitalware's MQ Technical Conference v2.0.1.6 An introduction to MQ Publish/Subscribe David Ware Lead Architect, IBM MQ Distributed dware@uk.ibm.com

Capitalware's MQ Technical Conference v2.0.1.615© 2016 IBM Corporation

Designing your topic tree structure

Make it extendable.

Understand a rapidly changing set of topic strings.

Avoid excessively wide or deep dynamic topic trees. Use structure where appropriate.

Limit it to subscribable content.

is

my

first

topic

/This/is/my/first/topic /This/is/my/second/topic

second

topic

Topic1

Topic1Topic2

Topic2

Topic3

Topic3Topic4

Topic4

Topic5

Topic5

Topic6

Topic6

Topic7

Topic7

Topic8

Topic8

Topic9

Topic9Topic10

Topic10

Topic1

Topic1Topic2

Topic2

Topic3

Topic3Topic4

Topic4

Topic5

Topic5

Topic6

Topic6

Topic7

Topic7

Topic8

Topic8

Topic9

Topic9Topic10

Topic10

Topic1

Topic1Topic2

Topic2

Topic3

Topic3Topic4

Topic4

Topic5

Topic5

Topic6

Topic6

Topic7

Topic7

Topic8

Topic8

Topic9

Topic9Topic10

Topic10

Topic1 Topic2 Topic3 Topic4 Topic1000

Topic1 Topic2 Topic3 Topic3 Topic1000

AppA AppB AppC

This

Page 13: An introduction to MQ Publish/Subscribe...Capitalware's MQ Technical Conference v2.0.1.6 An introduction to MQ Publish/Subscribe David Ware Lead Architect, IBM MQ Distributed dware@uk.ibm.com

Capitalware's MQ Technical Conference v2.0.1.6

configuration

Page 14: An introduction to MQ Publish/Subscribe...Capitalware's MQ Technical Conference v2.0.1.6 An introduction to MQ Publish/Subscribe David Ware Lead Architect, IBM MQ Distributed dware@uk.ibm.com

Capitalware's MQ Technical Conference v2.0.1.621© 2016 IBM Corporation

VEGOBJTOPICSTR(‘/Price/Vegetables’)

FRUITOBJTOPICSTR(‘/Price/Fruit’)

Topic Objects

Price

Fruit

Apples Oranges

Vegetables

Potatoes

SYSTEM.BASE.TOPICTOPICSTR(‘’)

You start with a base object defined for the ‘ ’ node … the rest are optional.

They provide hook points in the topic tree to configure specific pub/sub behaviour for a branch.

A dynamically created topic node inherits its attributes from administered topic objectsassociated with topic nodes above it in the topic tree.

Topic objects are a point of administration associated with a node in the topic tree.

Page 15: An introduction to MQ Publish/Subscribe...Capitalware's MQ Technical Conference v2.0.1.6 An introduction to MQ Publish/Subscribe David Ware Lead Architect, IBM MQ Distributed dware@uk.ibm.com

Capitalware's MQ Technical Conference v2.0.1.623© 2016 IBM Corporation

FRUITOBJPUB(ASPARENT)

DEFPSIST(YES)

Topic object attributes

Fruit

Oranges

SYSTEM.BASE.TOPICPUB(ENABLED)

DEFPSIST(NO)

Price

• Many attributes can be set on topic objects to effect a publisher or subscriber’s behaviour.

• Dynamic nodes inherit their behaviour from nodes above.

Create a topic object for topic string ‘/Price/Fruit’

DEFINE TOPIC(FRUITOBJ) TOPICSTR(‘/Price/Fruit’) DEFPSIST(YES)

Attributes default to inherit settings from above (e.g. ‘ASPARENT’).

(So by default, a new object does nothing)

Publish a message to topic string ‘/Price/Fruit/Oranges’

Are publications enabled?

What message persistence to use?

PUB = ?

PUB = ENABLED

PUB = ?

DEFPSIST = ?

DEFPSIST = YES

Publisher

PUB = ?

YES

ENABLED

Page 16: An introduction to MQ Publish/Subscribe...Capitalware's MQ Technical Conference v2.0.1.6 An introduction to MQ Publish/Subscribe David Ware Lead Architect, IBM MQ Distributed dware@uk.ibm.com

Capitalware's MQ Technical Conference v2.0.1.624© 2016 IBM Corporation

SYSTEM.BASE.TOPIC

FRUITOBJ

Topic Security

Access control is set as for queues, but for a

defined topic object, not a topic string!

Authority checks performed on the topic tree Walk up the tree, just like attributes.

Keep checking until an authorisation is found or we

run out of topic tree.

Apples

Bob

Price

VEGOBJ

Jane

Vegetables

Subscription/Price/Fruit/Apples

Bob

Jane?

Jane?

Jane

Subscription/Price/Fruit/Apples

FruitBob?

Page 17: An introduction to MQ Publish/Subscribe...Capitalware's MQ Technical Conference v2.0.1.6 An introduction to MQ Publish/Subscribe David Ware Lead Architect, IBM MQ Distributed dware@uk.ibm.com

Capitalware's MQ Technical Conference v2.0.1.6

Managing topics

Page 18: An introduction to MQ Publish/Subscribe...Capitalware's MQ Technical Conference v2.0.1.6 An introduction to MQ Publish/Subscribe David Ware Lead Architect, IBM MQ Distributed dware@uk.ibm.com

Capitalware's MQ Technical Conference v2.0.1.627© 2016 IBM Corporation

Managing topics

Displaying topic object definitions This shows how administered topic objects are configured

5724-H72 (C) Copyright IBM Corp. 1994, 2014.Starting MQSC for queue manager QMGR1. DISPLAY

DISPLAY TOPIC(*)1 : DISPLAY TOPIC(*)

AMQ8633: Display topic details.TOPIC(FRUITOBJ) TYPE(LOCAL)

AMQ8633: Display topic details.TOPIC(SYSTEM.BASE.TOPIC) TYPE(LOCAL)

AMQ8633: Display topic details.TOPIC(SYSTEM.BROKER.ADMIN.STREAM) TYPE(LOCAL)

AMQ8633: Display topic details.TOPIC(SYSTEM.BROKER.DEFAULT.STREAM) TYPE(LOCAL)

AMQ8633: Display topic details.TOPIC(SYSTEM.BROKER.DEFAULT.SUBPOINT) TYPE(LOCAL)

AMQ8633: Display topic details.TOPIC(SYSTEM.DEFAULT.TOPIC) TYPE(LOCAL)

AMQ8633: Display topic details.TOPIC(VEGOBJ) TYPE(LOCAL)

DISPLAY TOPIC(FRUITOBJ)2 : DISPLAY TOPIC(FRUITOBJ)

AMQ8633: Display topic details.TOPIC(FRUITOBJ) TYPE(LOCAL)TOPICSTR(/Price/Fruit) DESCR(Price of fruit)CLUSTER( ) CLROUTE(DIRECT)DURSUB(ASPARENT) PUB(ASPARENT)SUB(ASPARENT) DEFPSIST(YES)DEFPRTY(ASPARENT) DEFPRESP(ASPARENT)ALTDATE(2015-02-03) ALTTIME(08.44.48)PMSGDLV(ASPARENT) NPMSGDLV(ASPARENT)PUBSCOPE(ASPARENT) SUBSCOPE(ASPARENT)PROXYSUB(FIRSTUSE) WILDCARD(PASSTHRU)MDURMDL( ) MNDURMDL( )MCAST(ASPARENT) COMMINFO( )USEDLQ(ASPARENT) CUSTOM( )

DISPLAY TOPIC(FRUITOBJ)2 : DISPLAY TOPIC(FRUITOBJ)

AMQ8633: Display topic details.TOPIC(FRUITOBJ) TYPE(LOCAL)TOPICSTR(/Price/Fruit) DESCR(Price of fruit)CLUSTER( ) CLROUTE(DIRECT)DURSUB(ASPARENT) PUB(ASPARENT)SUB(ASPARENT) DEFPSIST(YES)DEFPRTY(ASPARENT) DEFPRESP(ASPARENT)ALTDATE(2015-02-03) ALTTIME(08.44.48)PMSGDLV(ASPARENT) NPMSGDLV(ASPARENT)PUBSCOPE(ASPARENT) SUBSCOPE(ASPARENT)PROXYSUB(FIRSTUSE) WILDCARD(PASSTHRU)MDURMDL( ) MNDURMDL( )MCAST(ASPARENT) COMMINFO( )

USEDLQ(ASPARENT) CUSTOM( )

Page 19: An introduction to MQ Publish/Subscribe...Capitalware's MQ Technical Conference v2.0.1.6 An introduction to MQ Publish/Subscribe David Ware Lead Architect, IBM MQ Distributed dware@uk.ibm.com

Capitalware's MQ Technical Conference v2.0.1.629© 2016 IBM Corporation

Managing topics

Displaying the topic tree This shows how the topic nodes in the topic tree behave

5724-H72 (C) Copyright IBM Corp. 1994, 2014.Starting MQSC for queue manager QMGR1. DISPLAY

DISPLAY PUBSUB ALL1 : display PUBSUB all

AMQ8723: Display pub/sub status details.QMNAME(QMGR1) TYPE(LOCAL)STATUS(ACTIVE) SUBCOUNT(4)TPCOUNT(11)

DISPLAY TPSTATUS(‘#’) TOPICSTR WHERE(SUBCOUNT GT 0)22 : DISPLAY TPSTATUS('#') TOPICSTR where(SUBCOUNT GT 0)

AMQ8754: Display topic status details.TOPICSTR(/Price/Vegetables/Potatoes) SUBCOUNT(1)

AMQ8754: Display topic status details.TOPICSTR(/Price/Fruit/Oranges) SUBCOUNT(2)

AMQ8754: Display topic status details.TOPICSTR(/Price/Fruit/Apples) SUBCOUNT(1)

DISPLAY TPSTATUS('/Price/Fruit/Apples')23 : DISPLAY TPSTATUS('/Price/Fruit/Apples')

AMQ8754: Display topic status details.TOPICSTR(/Price/Fruit/Apples) ADMIN( )CLUSTER( )COMMINFO(SYSTEM.DEFAULT.COMMINFO.MULTICAST)MDURMDL(SYSTEM.DURABLE.MODEL.QUEUE)MNDURMDL(SYSTEM.NDURABLE.MODEL.QUEUE)CLROUTE(NONE) DEFPSIST(YES)DEFPRTY(0) DEFPRESP(SYNC)DURSUB(YES) PUB(ENABLED)SUB(ENABLED) PMSGDLV(ALLDUR)NPMSGDLV(ALLAVAIL) RETAINED(NO)MCAST(DISABLED) PUBCOUNT(0)SUBCOUNT(1) PUBSCOPE(ALL)SUBSCOPE(ALL) USEDLQ(YES)

V8

DISPLAY TPSTATUS('/Price/Fruit/Apples')23 : DISPLAY TPSTATUS('/Price/Fruit/Apples')

AMQ8754: Display topic status details.TOPICSTR(/Price/Fruit/Apples) ADMIN( )CLUSTER( )COMMINFO(SYSTEM.DEFAULT.COMMINFO.MULTICAST)MDURMDL(SYSTEM.DURABLE.MODEL.QUEUE)MNDURMDL(SYSTEM.NDURABLE.MODEL.QUEUE)CLROUTE(NONE) DEFPSIST(YES)DEFPRTY(0) DEFPRESP(SYNC)DURSUB(YES) PUB(ENABLED)SUB(ENABLED) PMSGDLV(ALLDUR)NPMSGDLV(ALLAVAIL) RETAINED(NO)MCAST(DISABLED) PUBCOUNT(0)SUBCOUNT(1) PUBSCOPE(ALL)SUBSCOPE(ALL) USEDLQ(YES)

Page 20: An introduction to MQ Publish/Subscribe...Capitalware's MQ Technical Conference v2.0.1.6 An introduction to MQ Publish/Subscribe David Ware Lead Architect, IBM MQ Distributed dware@uk.ibm.com

Capitalware's MQ Technical Conference v2.0.1.6

Applications

Page 21: An introduction to MQ Publish/Subscribe...Capitalware's MQ Technical Conference v2.0.1.6 An introduction to MQ Publish/Subscribe David Ware Lead Architect, IBM MQ Distributed dware@uk.ibm.com

Capitalware's MQ Technical Conference v2.0.1.632© 2016 IBM Corporation

Applications and topics

When creating subscriptions or opening topics to publish on, do I use a topic string or a

topic object? A topic string. No, a topic object. No, both. Actually, er, any of them!

So which should I use?

Using the topic string is probably the easiest, it’s closest to what the application is expecting

Sub( - , ‘/Price/Fruit/Apples’ ) →

Using a topic object maps the operation to the topic string of that topic object

Sub( FRUITOBJ, ‘’ ) →

If you use both, you get both!

The topic string is appended to the topic string of the object

Sub( FRUITOBJ, ‘Apples’ ) →

If in doubt, check the topic tree for which nodes are actually being used

/Price/Fruit/Apples

/Price/Fruit

/Price/Fruit/Apples

Page 22: An introduction to MQ Publish/Subscribe...Capitalware's MQ Technical Conference v2.0.1.6 An introduction to MQ Publish/Subscribe David Ware Lead Architect, IBM MQ Distributed dware@uk.ibm.com

Capitalware's MQ Technical Conference v2.0.1.6

Subscriptions

Page 23: An introduction to MQ Publish/Subscribe...Capitalware's MQ Technical Conference v2.0.1.6 An introduction to MQ Publish/Subscribe David Ware Lead Architect, IBM MQ Distributed dware@uk.ibm.com

Capitalware's MQ Technical Conference v2.0.1.634© 2016 IBM Corporation

Subscription types

• There are many different types of subscriptions:

• Administered or application created

• Durable or non-durable

• Managed or unmanaged subscription queues

• These different aspects of a subscription can be combined, don’t

assume it’s one or the other…

Page 24: An introduction to MQ Publish/Subscribe...Capitalware's MQ Technical Conference v2.0.1.6 An introduction to MQ Publish/Subscribe David Ware Lead Architect, IBM MQ Distributed dware@uk.ibm.com

Capitalware's MQ Technical Conference v2.0.1.635© 2016 IBM Corporation

Subscription types

Subscription creation and deletion

Application created subscriptions Applications use an API to dynamically create and delete subscriptions

Administratively created subscriptions An administrator defines subscriptions that can be accessed by applications

Applications can either use the publish/subscribe APIs to access these subscriptions or access their

associated queue using point-to-point APIs.

Admin

Application

Page 25: An introduction to MQ Publish/Subscribe...Capitalware's MQ Technical Conference v2.0.1.6 An introduction to MQ Publish/Subscribe David Ware Lead Architect, IBM MQ Distributed dware@uk.ibm.com

Capitalware's MQ Technical Conference v2.0.1.637© 2016 IBM Corporation

Subscription types

Subscription lifetime

Durable subscriptions The lifetime of the subscription is independent of any application

Non-durable subscriptions The lifetime of the subscription is bounded by the creating application

Subscriptions are automatically deleted when the application closes

Admin

Application

Durable Non-durable

Admin

Application

Page 26: An introduction to MQ Publish/Subscribe...Capitalware's MQ Technical Conference v2.0.1.6 An introduction to MQ Publish/Subscribe David Ware Lead Architect, IBM MQ Distributed dware@uk.ibm.com

Capitalware's MQ Technical Conference v2.0.1.639© 2016 IBM Corporation

Subscription types

Subscription queue management

A subscription maps a topic to a queue. The queue relationship is either explicit or

implicit…

Managed subscription queue The subscription automatically creates and deletes a queue for the use of queuing any matching

publications.

Unmanaged subscription queue When the subscription is created the name and location of an existing queue must be provided by you.

Admin

Application

Durable Non-durable

Admin

Application

Managed Unmanaged

Durable Non-durable Durable Non-durable

Admin

Application(Not JMS) (Not JMS)

Page 27: An introduction to MQ Publish/Subscribe...Capitalware's MQ Technical Conference v2.0.1.6 An introduction to MQ Publish/Subscribe David Ware Lead Architect, IBM MQ Distributed dware@uk.ibm.com

Capitalware's MQ Technical Conference v2.0.1.641© 2016 IBM Corporation

Accessing a subscription’s messages

Via the subscription

An application opens the subscription A true pub/sub application

Works with managed and unmanaged subscription queues

Limited to one attached consuming application at a time Unless you’re using JMS cloned/shared subscriptions

Generally better pub/sub status feedback

Via the queue

An application opens the queue associated with the subscription This is really a point-to-point application

Only works with unmanaged subscription queues

Allows more freedom in what can be done For example, multiple concurrent consuming applications

possible from any API

Consumingapplication

Subscription

Subscription

queue

Unmanaged queue

Consumingapplication

Consumingapplication

Consumingapplication

Page 28: An introduction to MQ Publish/Subscribe...Capitalware's MQ Technical Conference v2.0.1.6 An introduction to MQ Publish/Subscribe David Ware Lead Architect, IBM MQ Distributed dware@uk.ibm.com

Capitalware's MQ Technical Conference v2.0.1.644© 2016 IBM Corporation

Managing subscriptions

Displaying subscriptions This shows the subscriptions on a queue manager

5724-H72 (C) Copyright IBM Corp. 1994, 2014.Starting MQSC for queue manager QMGR1. DISPLAY

DISPLAY SUB(*) TOPICSTR1 : DISPLAY SUB(*) TOPICSTR

AMQ8096: WebSphere MQ subscription inquired.SUBID(414D5120514D4752312020202020202007183D5320002306)SUB(SUB1) TOPICSTR(/Price/Fruit/Apples)

AMQ8096: WebSphere MQ subscription inquired.SUBID(414D5120514D4752312020202020202004183D5310000006)SUB(SYSTEM.DEFAULT.SUB) TOPICSTR()

AMQ8096: WebSphere MQ subscription inquired.SUBID(414D5120514D4752312020202020202007183D5320002312)SUB(SUB3) TOPICSTR(/Price/Vegetables/Potatoes)

SUBID(414D5120514D4752312020202020202007183D532000230C)SUB(SUB2) TOPICSTR(/Price/Fruit/Oranges)

DISPLAY SUB(SUB1)2 : DISPLAY SUB(SUB1)

AMQ8096: WebSphere MQ subscription inquired.SUBID(414D5120514D4752312020202020202007183D5320002306)SUB(SUB1) TOPICSTR(/Price/Fruit/Apples)TOPICOBJ( )DEST(SYSTEM.MANAGED.DURABLE.533D180705230020)DESTQMGR(QMGR1) PUBAPPID( )SELECTOR( ) SELTYPE(NONE)USERDATA( )PUBACCT(16010515000000DEA960DF651724E4B97C192FE803000000000B)DESTCORL(414D5120514D4752312020202020202007183D5320002306)DESTCLAS(MANAGED) DURABLE(YES)EXPIRY(UNLIMITED) PSPROP(MSGPROP)PUBPRTY(ASPUB) REQONLY(NO)SUBSCOPE(ALL) SUBLEVEL(1)SUBTYPE(ADMIN) VARUSER(ANY)WSCHEMA(TOPIC) SUBUSER(xxxx)CRDATE(2014-04-03) CRTIME(09:19:15)ALTDATE(2014-04-03) ALTTIME(09:19:15)

DISPLAY SBSTATUS(SUB1)3 : DISPLAY SBSTATUS(SUB1)

AMQ8099: WebSphere MQ subscription status inquired.SUB(SUB1)SUBID(414D5120514D4752312020202020202007183D5320002306)SUBUSER(xxxx) RESMDATE(2014-04-03)RESMTIME(09:19:15) LMSGDATE( )LMSGTIME( )ACTCONN(000000000000000000000000000000000000000000000000)DURABLE(YES) MCASTREL( , )NUMMSGS(0) SUBTYPE(ADMIN)TOPICSTR(/Price/Fruit/Apples)

DISPLAY QLOCAL(SYSTEM.MANAGED.DURABLE.533D180705230020)

Page 29: An introduction to MQ Publish/Subscribe...Capitalware's MQ Technical Conference v2.0.1.6 An introduction to MQ Publish/Subscribe David Ware Lead Architect, IBM MQ Distributed dware@uk.ibm.com

Capitalware's MQ Technical Conference v2.0.1.6

Publishing

Page 30: An introduction to MQ Publish/Subscribe...Capitalware's MQ Technical Conference v2.0.1.6 An introduction to MQ Publish/Subscribe David Ware Lead Architect, IBM MQ Distributed dware@uk.ibm.com

Capitalware's MQ Technical Conference v2.0.1.647© 2016 IBM Corporation

Publication, success or failure?

Point-to-point is nice and simple:Did the message get onto the queue?Was it persistent and transacted?

ConsumerProducer

Page 31: An introduction to MQ Publish/Subscribe...Capitalware's MQ Technical Conference v2.0.1.6 An introduction to MQ Publish/Subscribe David Ware Lead Architect, IBM MQ Distributed dware@uk.ibm.com

Capitalware's MQ Technical Conference v2.0.1.648© 2016 IBM Corporation

Publication, success or failure?

Point-to-point is nice and simple:Did the message get onto the queue?Was it persistent and transacted?

Publish/subscribe is not so clear cut… Persistence and transactions still ensures integrity of successful

publications. But if one or more subscriptions can’t receive the publication, should the publish

fail?

Subscription

/Price/Fruit/Oranges

Publisher

/Price/Fruit/Oranges

Subscription

/Price/Fruit/Oranges

Subscription

/Price/Fruit/Oranges

Subscription

/Price/Fruit/Oranges

Page 32: An introduction to MQ Publish/Subscribe...Capitalware's MQ Technical Conference v2.0.1.6 An introduction to MQ Publish/Subscribe David Ware Lead Architect, IBM MQ Distributed dware@uk.ibm.com

Capitalware's MQ Technical Conference v2.0.1.649© 2016 IBM Corporation

Publication, success or failure?

Should those subscriptions impact the others, should the publisher know?

What if the subscriptions are durable and the publication is persistent?

Controlled at the topic level Persistent Message Delivery (PMSGDLV) and Non-persistent Message Delivery

(NPMSGDLV): ALL, ALLDUR, ALLAVAIL

Don’t forget that being able to DLQ a publication is still counted as a success!USEDLQ on the topic to fine tune this behaviour.

And finally, remember – when there are no subscriptions, no-one gets it. That’s still a successful publish!

Subscription

/Price/Fruit/Oranges

Publisher

/Price/Fruit/Oranges

Subscription

/Price/Fruit/Oranges

Subscription

/Price/Fruit/Oranges

Subscription

/Price/Fruit/Oranges

DLQ

Page 33: An introduction to MQ Publish/Subscribe...Capitalware's MQ Technical Conference v2.0.1.6 An introduction to MQ Publish/Subscribe David Ware Lead Architect, IBM MQ Distributed dware@uk.ibm.com

Capitalware's MQ Technical Conference v2.0.1.651© 2016 IBM Corporation

Retained publications

Price

Fruit

Apples Oranges

Subscription

/Price/Fruit/Oranges

Publisher

/Price/Fruit/Oranges

Subscription

/Price/Fruit/Oranges

When a message is published to a topic string, it is delivered to each matching subscription

registered at that time.

Subscriptions created after that point will not receive the message

only newly published ones.

Unless publications are retained

Page 34: An introduction to MQ Publish/Subscribe...Capitalware's MQ Technical Conference v2.0.1.6 An introduction to MQ Publish/Subscribe David Ware Lead Architect, IBM MQ Distributed dware@uk.ibm.com

Capitalware's MQ Technical Conference v2.0.1.652© 2016 IBM Corporation

Retained publications

When a message is published to a topic string, it is delivered to each matching subscription

registered at that time.

Subscriptions created after that point will not receive the message

only newly published ones.

Unless publications are retained

Every time a message is published, the most recent

publication for each topic string is retained by the

queue manager.

When a new subscription is created, any

matching retained message is

delivered to it.

Take care, using

retained can be subtle

Don’t confuse it with persistent publications

Price

Fruit

Apples Oranges

Subscription

/Price/Fruit/Oranges

Publisher

/Price/Fruit/Oranges

Subscription

/Price/Fruit/Oranges

Page 35: An introduction to MQ Publish/Subscribe...Capitalware's MQ Technical Conference v2.0.1.6 An introduction to MQ Publish/Subscribe David Ware Lead Architect, IBM MQ Distributed dware@uk.ibm.com

Capitalware's MQ Technical Conference v2.0.1.6

Topologies

Page 36: An introduction to MQ Publish/Subscribe...Capitalware's MQ Technical Conference v2.0.1.6 An introduction to MQ Publish/Subscribe David Ware Lead Architect, IBM MQ Distributed dware@uk.ibm.com

Capitalware's MQ Technical Conference v2.0.1.658© 2016 IBM Corporation

QMgr

Distributed publish/subscribe

QMgr

Topics

SubscriptionPublisher

Subscription

Subscription

Everything revolves around the topic tree,dynamically built up in a queue manager

Subscription

Page 37: An introduction to MQ Publish/Subscribe...Capitalware's MQ Technical Conference v2.0.1.6 An introduction to MQ Publish/Subscribe David Ware Lead Architect, IBM MQ Distributed dware@uk.ibm.com

Capitalware's MQ Technical Conference v2.0.1.659© 2016 IBM Corporation

QMgr

Topics

Subscription

Subscription

QMgrQMgr

Topics

Subscription

SubscriptionQMgrQMgr

Topics

Publisher

QMgrQMgr

Topics

SubscriptionPublisher

Subscription

Subscription

Everything revolves around the topic tree,dynamically built up in a queue manager

Queue managers can work together to share theirtopic tree knowledge between them

Distributed publish/subscribe

Page 38: An introduction to MQ Publish/Subscribe...Capitalware's MQ Technical Conference v2.0.1.6 An introduction to MQ Publish/Subscribe David Ware Lead Architect, IBM MQ Distributed dware@uk.ibm.com

Capitalware's MQ Technical Conference v2.0.1.660© 2016 IBM Corporation

QMgrQMgr

Topics

Publisher

QMgrQMgr

Topics

Subscription

QMgrQMgr

Topics

Subscription

Subscription

Everything revolves around the topic tree,dynamically built up in a queue manager

Queue managers can work together to share theirtopic tree knowledge between them

Enabling publications to be propagated tosubscriptions on different queue managers

The applications stay the same, the changesare at the configuration level.

Subscription

Distributed publish/subscribe

Page 39: An introduction to MQ Publish/Subscribe...Capitalware's MQ Technical Conference v2.0.1.6 An introduction to MQ Publish/Subscribe David Ware Lead Architect, IBM MQ Distributed dware@uk.ibm.com

Capitalware's MQ Technical Conference v2.0.1.661© 2016 IBM Corporation

Distributed publish/subscribe topologies

Publish/subscribe topologies can either be created as a defined hierarchy or more

dynamically as a cluster

Subscription

Publisher

Subscription

Subscription

Publisher

Subscription

Subscription

Subscription

Come to the pub/sub network session for much more on topologies…

Page 40: An introduction to MQ Publish/Subscribe...Capitalware's MQ Technical Conference v2.0.1.6 An introduction to MQ Publish/Subscribe David Ware Lead Architect, IBM MQ Distributed dware@uk.ibm.com

Capitalware's MQ Technical Conference v2.0.1.6

System topics (MQ V9)

Page 41: An introduction to MQ Publish/Subscribe...Capitalware's MQ Technical Conference v2.0.1.6 An introduction to MQ Publish/Subscribe David Ware Lead Architect, IBM MQ Distributed dware@uk.ibm.com

Capitalware's MQ Technical Conference v2.0.1.664© 2016 IBM Corporation

System topics – new for MQ V9 and the MQ Appliance

IBM MQ V9 (and the M2000 Appliance) has created its own branch of the topic tree• “$SYS/MQ”

This is used for publishing and subscribing to data from the queue manager

A new default object sits at the root of this branch, SYSTEM.ADMIN.TOPIC

It sits below SYSTEM.BASE.TOPIC but consider it a complete new tree• No attributes are inherited from above

• No authorities are inherited from above

• The topic nodes are not matched by wildcards above it

– E.g. Subscribing to ‘#’ will not matchanything starting “$SYS/MQ”

Out of the box, access to the branch is restricted to administrators only

• Access can be granted to other users through thedefinition of admin topics and access control at key points below $SYS/MQ

SYSTEM.BASE.TOPIC‘’

SYSTEM.ADMIN.TOPIC‘$SYS/MQ’

user space

MQ’s space

Page 42: An introduction to MQ Publish/Subscribe...Capitalware's MQ Technical Conference v2.0.1.6 An introduction to MQ Publish/Subscribe David Ware Lead Architect, IBM MQ Distributed dware@uk.ibm.com

Capitalware's MQ Technical Conference v2.0.1.665© 2016 IBM Corporation

New system topic publications

MQ V9 publishes two types to data under thesystem topic branch

• Application activity trace

• Resource monitoring

Each queue manager listens for subscriptions to recognised topic strings and only publishes when subscriptions exist

SYSTEM.ADMIN.TOPIC‘SYS/MQ’

$SYS/MQ/INFO/QMGR

$SYS/MQ/INFO/QMGR/QM1

$SYS/MQ/INFO/QMGRQM1/ActivityTrace $SYS/MQ/INFO/QMGR/QM1/Monitor

Page 43: An introduction to MQ Publish/Subscribe...Capitalware's MQ Technical Conference v2.0.1.6 An introduction to MQ Publish/Subscribe David Ware Lead Architect, IBM MQ Distributed dware@uk.ibm.com

Capitalware's MQ Technical Conference v2.0.1.666© 2016 IBM Corporation

Subscribe to MQ and system monitoring information

• Subscribe for a regular feed of performance monitoring information

• Familiar queue manager wide and queue level statistics

• Plus new CPU, memory and disk usage• For example, disk reads/writes, disk latency

• Enables integration into multiple monitoring solutions

$ amqsrua -m V9000_A

CPU : Platform central processing units

DISK : Platform persistent data stores

STATMQI : API usage statistics

STATQ : API per-queue usage statistics

Enter Class selection

CPU

SystemSummary : CPU performance - platform wide

QMgrSummary : CPU performance - running queue manager

Enter Type selection

SystemSummary

Publication received PutDate:20160411 PutTime:10465573

User CPU time percentage 0.01%

System CPU time percentage 1.30%

CPU load - one minute average 8.00

CPU load - five minute average 7.50

CPU load - fifteen minute average 7.30

RAM free percentage 2.02%

RAM total bytes 8192MB

Publication received PutDate:20160411 PutTime:10466573

User CPU time percentage 0.01%

System CPU time percentage 1.30%

This capability already underpins the charting in the MQ Appliance WebUI

Sample tool demonstrates the capabilities and coding

Simplifies integration into off the shelf tooling

Page 44: An introduction to MQ Publish/Subscribe...Capitalware's MQ Technical Conference v2.0.1.6 An introduction to MQ Publish/Subscribe David Ware Lead Architect, IBM MQ Distributed dware@uk.ibm.com

Capitalware's MQ Technical Conference v2.0.1.667© 2016 IBM Corporation

Subscribe to Application Activity Trace

$ amqsact -m QMGR1 -a amqsput -w 60

Subscribing to the activity trace topic:

'$SYS/MQ/INFO/QMGR/QMGR1/ActivityTrace/ApplName/amqsput'

MonitoringType: MQI Activity Trace

QueueManager: ‘QMGR1'

ApplicationName: 'amqsput'

Application Type: MQAT_UNIX

============================================================================

=

Tid Date Time Operation CompCode MQRC HObj

(ObjName)

001 2016-04-14 09:56:53 MQXF_CONNX MQCC_OK 0000 -

001 2016-04-14 09:56:53 MQXF_OPEN MQCC_OK 0000 2 (QUEUE1)

001 2016-04-14 09:56:53 MQXF_PUT MQCC_OK 0000 2 (QUEUE1)

001 2016-04-14 09:56:53 MQXF_PUT MQCC_OK 0000 2 (QUEUE1)

001 2016-04-14 09:56:53 MQXF_CLOSE MQCC_OK 0000 2 (QUEUE1)

001 2016-04-14 09:56:53 MQXF_DISC MQCC_OK 0000 -

============================================================================

=

• See exactly what applications are doing with a live stream of data on their API calls

• Useful for tracking application usage and diagnosing application errors

• Subscribe to an application’s name, a channel being used or a specific connection

• Sample tool for dynamic monitoring and formatting of trace

$ amqsput QUEUE1 QMGR1

Sample AMQSPUT0 start

target queue is Q1

Hello

World

Sample AMQSPUT0 end

Page 45: An introduction to MQ Publish/Subscribe...Capitalware's MQ Technical Conference v2.0.1.6 An introduction to MQ Publish/Subscribe David Ware Lead Architect, IBM MQ Distributed dware@uk.ibm.com

Capitalware's MQ Technical Conference v2.0.1.6

Summary

• Publish/Subscribe in WebSphere MQ

• Administration of publish/subscribe

• Management of publish/subscribe

• Subscriptions and publications

• Topologies

Page 46: An introduction to MQ Publish/Subscribe...Capitalware's MQ Technical Conference v2.0.1.6 An introduction to MQ Publish/Subscribe David Ware Lead Architect, IBM MQ Distributed dware@uk.ibm.com

Capitalware's MQ Technical Conference v2.0.1.669© 2016 IBM Corporation

Questions & Answers

Page 47: An introduction to MQ Publish/Subscribe...Capitalware's MQ Technical Conference v2.0.1.6 An introduction to MQ Publish/Subscribe David Ware Lead Architect, IBM MQ Distributed dware@uk.ibm.com

Capitalware's MQ Technical Conference v2.0.1.670© 2016 IBM Corporation

Legal Disclaimer

• © IBM Corporation 2015. All Rights Reserved.

• The information contained in this publication is provided for informational purposes only. While efforts were made to verify the completeness and accuracy of the information contained in this

publication, it is provided AS IS without warranty of any kind, express or implied. In addition, this information is based on IBM’s current product plans and strategy, which are subject to change by IBM

without notice. IBM shall not be responsible for any damages arising out of the use of, or otherwise related to, this publication or any other materials. Nothing contained in this publication is intended to,

nor shall have the effect of, creating any warranties or representations from IBM or its suppliers or licensors, or altering the terms and conditions of the applicable license agreement governing the use

of IBM software.

• References in this presentation to IBM products, programs, or services do not imply that they will be available in all countries in which IBM operates. Product release dates and/or capabilities

referenced in this presentation may change at any time at IBM’s sole discretion based on market opportunities or other factors, and are not intended to be a commitment to future product or feature

availability in any way. Nothing contained in these materials is intended to, nor shall have the effect of, stating or implying that any activities undertaken by you will result in any specific sales, revenue

growth or other results.

• All customer examples described are presented as illustrations of how those customers have used IBM products and the results they may have achieved. Actual environmental costs and performance

characteristics may vary by customer.


Recommended