© 2010 IBM Corporation
WebSphere Message Broker Version 7
Publish / subscribe in Message Broker V7
Jonathan Woodford
Jonathan Woodford, Message Broker Development
© 2010 IBM Corporation2
Agenda
� Background
� Topic Based Publish Subscribe
� Content Based Publish Subscribe
� Migration
Topic: INFO/#
Filter: year > 1993 AND cast = “%Kelsey Grammer%”
Message Broker
MQ
Interface
Content BasedFiltering
Content BasedFiltering
© 2010 IBM Corporation3
Example of a Flow that handles ‘Publish / Subscribe’
� Publication messages handled within the flow– Publication node receives publication messages and distributes to the subscribers
matching the topic within the publication message
� MQ based subscription messages registered via a special queue– SYSTEM.BROKER.CONTROL.QUEUE– Do not need to define a flow to handle subscription requests
© 2010 IBM Corporation4
Justification
� There were two separate Publish / Subscribe engines –MQ Publish and Subscribe–Message Broker Publish and Subscribe
� Use completely different code bases
� Use different administration and configuration options / Tools
� Different security model
� Different capability!
© 2010 IBM Corporation5
Publish Subscribe History
� MQ v6 provided basic Publish / Subscribe capability
� If additional function was required, Message Broker / Event Broker could be used
� New enhancements introduced into MQ v7
Publish Subscribe function MQ v6.x Message
Broker v6.x
Topic based matching Yes Yes
Retained publication support Yes Yes
RFH (1) Support Yes Yes
RFH 2 Support No Yes
Security / Access Control (ACLs) No Yes
Centralised graphical
configuration
No Yes
High availability option No Yes
High performance non-
persistent option
No Yes
Available on all platforms Not
supported
on z/OS
Yes
© 2010 IBM Corporation6
MQ v7.0.x Enhancements
Publish Subscribe function MQ v7.x Message Broker
v6
Topic based matching Yes Yes
Retained publication support Yes Yes
RFH (1) Support Yes Yes
RFH 2 Support Yes Yes
Security / Access Control (ACLs) Yes Yes
Centralised graphical
configuration
Yes Yes
High availability option Yes Yes
High performance non-persistent
option
Yes Yes
Available on all platforms Yes Yes
‘Put to topic’ Yes No
� MQ v7.0.x significantly enhanced the Publish Subscribe function
© 2010 IBM Corporation7
Topic Based Publish Subscribe
© 2010 IBM Corporation8
MQ PubSub Exploitation within Message Broker
� Publication node re-written to interface with the matching engine within MQ
– Forwards publication messages to MQ
• Parses message being propagated to Publication node and calls MQ API (v7) to allow MQ to match and deliver to subscribers
– The Publication node has the same external behaviour as previous versions
• Supports ‘Publication’ and ‘Delete Publication’ requests.
• Supports RFH & RFH2
• Support subscription points for RFH2 messages
• Supports streams for RFH messages
� Subscription requests handled by MQ
– Queued subscriptions handled by MQ’s Queued Publish Subscribe Interface
• Owns SYSTEM.BROKER.CONTROL.QUEUE
• PSMODE must be set to ‘ENABLED’ if using queued (RFH/2) Publish Subscribe
PubSub Engine
(MQ)
PubSub Engine
© 2010 IBM Corporation9
9
� Terminals provided on Publication node
� Drives flow depending on subscribers matching publication
– No-match terminal
• If there are no matching subscribers
– Out terminal
• If one or more subscribers match
� Propagates same message assembly as input.
� Has no effect on delete publication message requests
Publication node - No-match & Out terminals
© 2010 IBM Corporation10
Content Filtering Based Publish Subscribe
© 2010 IBM Corporation11
Content Based Filtering
� Content based filtering allows a subscriber to restrict the messages that it wants to receive
– When a client registers a subscription, it can specify a filter to be applied to the content of fields within each publication message
– The filter itself is entered as an SQL expression
• Body.Name LIKE 'Smit%'
� The MQv7.0.1 matching engine supports filtering on the header (Message Properties) of the message
� Message Broker supports filtering on the whole message, including the body of the message
� MQ queue manager will use message body parsing provided by MB to support Content Based Filtering
– Message Broker building on the function provided by MQ
� Any ESQL Expression supported with below correlation names
– Root.
– Body.
– Properties.
– ‘Dynamic’
• Any name excluding defined set
� Supports Namespaces
� Builds on constants provided by MQ (Including JMS Constants)– JMSCorrelationID, JMSDeliveryMode, JMSDestination, JMSExpiration, JMSPriority, JMSReplyTo, JMSTimestamp,
JMSType
Message Broker
MQ
Interface
Content BasedFiltering
Content BasedFiltering
Topic: INFO/#
Filter: year > 1993 AND cast = “%Kelsey Grammer%”
© 2010 IBM Corporation12
Content Based filtering Configuration� Service runs within nominated execution groups
� If Message Broker does not have at least one execution group enabled for Content Based Filtering, MQ can only support ‘Message Selection’ (for MPs).
– Message Broker enables ‘MQ’ to support Extended Message Selection / Content Based Filtering
� All nominated execution groups must have ALL of the required message sets deployed if using MRM
� No flow required to support Content Based Filtering
� Can be enabled depending on users preference (default is disabled)– MBX– ConfigMgr Proxy– CommandLine (mqsichangeProperties)
• mqsichangeproperties MyBrk –e default –o ContentBasedFiltering –n cbfEnabled –v true
� Options– Content Based Filtering Enabled / Disabled– Number of Validation Threads (1 - 32)– Number of Evaluation Threads (1 - 32)
© 2010 IBM Corporation13
© 2010 IBM Corporation14
1
4
Retargetting of Components
� Username Server
– Provides security (user / group) information to the Broker
– Allows ACLs to be defined for certain users– Primarily used for Publish Subscribe
• No longer required due to Publish Subscribe being handled by MQ
� SCADA nodes– Publish Subscribe transport
• Better placed within Base MQ
• Transport has been picked up by MQ
� RealTime node
– Replaced with the high performance options (MQ's streaming client
technology) provided within MQv7
• Batched get
• Fire & Forget
– Scribble sample updated to remove Realtime transport.
© 2010 IBM Corporation15
1
5
MB SubscriptionsPanel
MQ SubscriptionsPanel
© 2010 IBM Corporation16
1
6
MB ‘Topic’Configuration
MQ ‘Topic’Configuration
© 2010 IBM Corporation17
Migration Paths
© 2010 IBM Corporation18
1
8
Supported Migration Paths
� Migration from Event Broker to MQ v7.0.1• Event Broker is a subset of Message Broker
Code stabilised at Event Broker v6.0
• Requires MB to support Content Based Filtering
� Migration from Event Broker to Message Broker
• Continues to support Content Based Filtering
� Migration from Message Broker v6.x to Message Broker v7.
– Supported versions
• Message Broker v6.1
• Message Broker v6.0
� Note that Message Broker v7.0 pre-reqs MQ v7.0.1
© 2010 IBM Corporation19
1
9
Features that will help you to migrate
� MB v7 can be installed on the same machine as, and run alongside, all previous versions of the product
� Single command to migrate runtime components between versions (mqsimigratecomponents)
� Single command to migrate Publish Subscribe state (migmbbrk)
� No redeploys required if not using SCADA or RealTimenodes
� The v7 broker can be migrated back to v6.1 or v6.0
© 2010 IBM Corporation20
2
0
State Migration Tool
� Allows the Publish Subscribe state held within Message Broker to be migrated to MQ– Subscriptions– Retained Publications– ACLs
• Generates script to migrate ‘positive’ ACLs
� Shipped in MQ v7.0.1• Command called ‘migmbbrk’
� Required when using any aspect of Publish Subscribe– Directly exploiting PubSub via Publication node– Accounting and Statistics– Monitoring
© 2010 IBM Corporation21
2
1
State Migration Tool
� May be run against MB v6.0 / 6.1 or EB v6.0– Can not be run against an MB v7.0 broker
• State no-longer held within MB
� migmbbrk needs to be run twice1)Creates topic objects within MQ. It also generates the security script [-t]2)Populates MQ matchspace (subscriptions and retained publications) [-c]
� Usagemigmbbrk [-r] [-t] [-c] [-o] [-s] [-z] [-l] -b BrokerName• -t / -c create topic objects / migrate subscriptions & publication
• -r Rehearsal
• -b Broker name• -o Overwrite (force if a subscription / retained publication already exists)
• -z Force a migration if migration has already been completed
• -s Clear out any previous data before re-attempting migration
• -l Leave broker running, otherwise it will be shutdown.
� Produces log file to record migration status
© 2010 IBM Corporation22
2
2
V7.0.1 QMgr
MB Migration Approach #1
Machine A’s File System
MB V6 or V6.1 Product Install
BrokerA ConfigMgr
MB V7 Product Install
V6.x Command Console
migmbbrk –t ………
Set PubSub ACLs according to generated script
migmbbrk –c ………
V7 Command Console
mqsimigratecomponents BrokerA
PubSubState
PubSubState
© 2010 IBM Corporation23
2
3
V7.0.1 QMgr BV7.0.1 QMgr
MB Migration Approach #2
Machine A’s File System
MB V6 or V6.1 Product Install
BrokerA ConfigMgr
MB V7 Product Install
BrokerB
PubSubState
PubSubState
© 2010 IBM Corporation24
Collectives Migration
� MB allows brokers to be interconnected and logically share a single matchspace by joining brokers within a 'collective'.
– MQ v7.0.1 supports PubSub clusters which uses a different protocol
� All brokers will need to be migrated together
� For each broker in the Collective perform the following steps
� Remove broker from Collective
� Migrate broker as described in migration approach #1
� Add queue manager associated with Broker to P/S Cluster
� Restart all brokers
Broker 5
Broker 5
Broker 6Broker 6
Broker 4
Broker 4
QMgrQMgr
QMgrQMgr
Broker 1Broker 1Broker
2Broker
2
QMgrQMgr
Broker 3
Broker 3
MB v6.x MB v7 with MQ v7
Migrate
© 2010 IBM Corporation25
� Questions?
Top Related