IDS and Websphere MQ
Integration
Jerry Keesee, Director of the Informix lab
Keshava Murthy, IDS Architect
IBM Software Group / Information Management
Agenda
Websphere MQ
IDS Support for MQ
MQ Functions
2-phase commit support
Platforms
Q&A
2
09/07/2005
© 2004 IBM Corporation
IBM Software Group / Information Management
Webspher MQ
3
09/07/2005
© 2004 IBM Corporation
IBM Software Group / Information Management
Websphere MQ Scenario
Websphere MQ
Q1…
Informix Dynamic Server
Q2…
Transaction Manager
Application
4
09/07/2005
© 2004 IBM Corporation
IBM Software Group / Information Management
IDS and MQ
Overview
Use SQL callable Routines exchange data with MQ
INSERT into tasktab values(MQREAD(“Myservice”));
SELECT MQSEND(“UService”, order || “:“ || address)
FROM tab where cno = 12345;
Functionality available when you install IDS.
IDS and MQ interaction is transactionally protected
This Feature uses IDS transaction manager to support
XACompliant Resource Managers.
This feature is available starting in10.00.UC3
5
09/07/2005
© 2004 IBM Corporation
IBM Software Group / Information Management
Websphere MQ Scenario
Websphere MQ
Informix Dynamic Server
Q1…
Q2…
MQ Functions
Application
6
09/07/2005
Application
© 2004 IBM Corporation
IBM Software Group / Information Management
MQ Series Scenario
Direct interaction
using MQ Functions
App-4
App-3
Z/OS
Informix Dynamic Server
MQ Functions
Websphere MQ
Q1…
DB2 on Z/OS
Q2…
MQ-DB2
database
module
7
App-1
Transaction Manager
App-2
09/07/2005
© 2004 IBM Corporation
IBM Software Group / Information Management
IDS MQ Integration
MQ Message Broker
MQ Queue Manager
Websphere MQ
IDS database server
IDS XA Transaction manager
Infrastructure
Acme_queue_manager
IDS client
Inventory_queue
MQ
Functions
IDS client
IDS client
MQSeries UDR
and XA support
UDRs [xa_open,
xa_commit,
xa_rollback, etc]
Orders_queue
M
Q
I
backorder_queue
MQ Queue
8
09/07/2005
© 2004 IBM Corporation
IBM Software Group / Information Management
IDS MQ Functions
• Direct IDS to Websphere MQ interaction
• SEND, RECEIVE, READ, PUBLISH, SUBSCRIBE Operations
• Supports character and clob types.
• Data from other data types have to be converted to these types.
• Access MQSeries Queue as a table
• READ and RECEIVE tables
• READ – non destructive browsing
• INSERT into these MQ tables will send the row to the QUEUE
• READ/RECEIVE from the table will retrieve msgs from the QUEUE
9
09/07/2005
© 2004 IBM Corporation
IBM Software Group / Information Management
Usage
MQ Policy
MQ Service
begin work;
-- read message with corrid
execute function mqread('IDS.SAMPLE.SERVICE', 'IDS.SAMPLE.POLICY',
'QA_MQ_ID_1');
Correlation ID
-- receive message with corrid
execute function mqreceive('IDS.SAMPLE.SERVICE', 'IDS.SAMPLE.POLICY',
'QA_MQ_ID_1');
commit work;
Transactional Boundary
begin work;
-- receives 10 orders from the ORDER queue
INSERT INTO ordertab SELECT FIRST 10 MQRECEIVE(‘MY.ORDER’)
from systables;
ROLLBACK
rollback work;
-- insert rows
begin work;
SELECT MQSEND(‘NEW.ORDER’, order || ‘:’ || address
FROM tab WHERE cno = 12345;
Commit work;
10
09/07/2005
© 2004 IBM Corporation
IBM Software Group / Information Management
MQCreateVtiRead
• Creates a local table that’s mapped to a websphere MQ Queue
• Provides a way to browse messages in the queue without
deleting the messages in the Queue.
Table Name
begin work;
execute function MQCreateVTIREAD(“myreadtable“,
“service”, “policy”, 4096);
commit work;
Max message size
Select first 10 * from myreadtable;
Insert into myreadtable values(“IBM:81.98;Volume:1020”);
11
09/07/2005
© 2004 IBM Corporation
IBM Software Group / Information Management
MQCreateVtiReceive
• Creates a local table that’s mapped to a websphere MQ Queue
• Provides a way get messages from the Queue.
• Messages are deleting from the queue once you read it (and
the transaction is committed.
begin work;
execute function MQCreateVTIReceive(“myreceivetab“,
“service”, “policy”, 4096);
commit work;
-- insert rows
begin work;
insert into mqvtitable(msg) values
("IBM:81.23;Volume:10100");
Commit work;
12
09/07/2005
© 2004 IBM Corporation
IBM Software Group / Information Management
MQCreateVtiReceive
create table myreceivetab
( msg
lvarchar(maxMessage),
correlid
topic
qname
msgid
varchar(24),
varchar(40),
varchar(48),
varchar(12),
msgformat varchar(8));
using "informix".mq (SERVICE =
service_name, POLICY = policy_name,
ACCESS = "RECEIVE");
13
09/07/2005
© 2004 IBM Corporation
IBM Software Group / Information Management
MQ Functions
– The following are the list of the MQ Functions.
• MQRead()
• MQReceive()
• MQSend()
• MQPublish()
• MQSubscribe()
• MQUnSubscribe()
• MQReadClob()
• MQReceiveClob()
• MQSendClob()
• MQTRACE()
• MQVERSION()
• MQCREATEVTIREAD()
• MQCREATEVTIRECEIVE()
– Except MQTRACE(), MQVERSION(), MQCREATEVTIREAD() and
MQCREATEVTIRECEIVE() all other functions needs be invoked with in
the transaction ( explicit or implicit)
14
09/07/2005
© 2004 IBM Corporation
IBM Software Group / Information Management
MQ Parameters: MQREAD
• service_name – should be a service in “informix”.mqiservice table (256
bytes max) Default: IDS.DEFAULT.SERVICE
• policy_name – should be a policy in “informix”.mqipolicy table (48
bytes max) Default: IDS.DEFAULT.POLICY
• correl_id -- correlation identifier for the message to be
read/received/sent. (24 bytes max)
15
09/07/2005
© 2004 IBM Corporation
IBM Software Group / Information Management
MQ Integration
MQ Message Broker
MQ Queue Manager
Websphere MQ
IDS database server
IDS XA Transaction
manager Infrastructure
Acme_queue_manager
IDS client
IDS client
IDS client
Inventory_queue
MQ
Data
Blade
MQSeries UDR
and XA support
UDRs [xa_open,
xa_commit,
xa_rollback, etc]
M
Q
I
Orders_queue
backorder_queue
MQ Queue
16
09/07/2005
© 2004 IBM Corporation
IBM Software Group / Information Management
• Description(Cont.)
– MQ Functions is part of IDS distribution
– Installed under $INFORMIXDIR/extend directory
– Install using blade manager.
– Configure an MQ VP
– VPCLASS mq,noyield,num=1 # in your $ONCONFIG file.
– In 10.00.xC3, MQ Functions are supported on the
following platforms.
•
•
•
•
17
Solaris 32bit
HPUX 32bit
AIX 32bit
Windows 32bit
– Please provide feedback on Platform Requirement.
– Using MQ Functions require WebSphere MQ Server
installation on the same machine where IDS running.
09/07/2005
© 2004 IBM Corporation
IBM Software Group / Information Management
• Description(Cont.)
– MQ QueueManager and MQ Queues needs to be
configured.
– following tables will be created during blade registration
• “informix”.mqiservice
• “informix”.mqipolicy
• “informix”.mqipubsub
– User needs to insert appropriate values for into this tables
to use the SERVICE, POLICY parameters of the MQ
functions.
18
09/07/2005
© 2004 IBM Corporation
IBM Software Group / Information Management
IDS MQ Tables
CREATE TABLE "informix".mqiservice
(servicename LVARCHAR(256),
queuemanager VARCHAR(48) NOT NULL,
queuename VARCHAR(48) NOT NULL,
defaultformat VARCHAR(8) default ’ ’,
ccsid VARCHAR(6) default ’ ’,
PRIMARY KEY (servicename) );
servicename is the service name used in the MQ functions.
queuemanager is the queue manager service provider.
queuename is the queue name to send the message to or receive the
message from.
defaultformat defines the default format.
ccsid is the coded character set identifier of the destination application.
19
09/07/2005
© 2004 IBM Corporation
IBM Software Group / Information Management
IDS MQ tables
• "informix".mqiservice
•Has long list of message attributes [like retry count, expiry date,
etc]
• Default Policy is “IDS.DEFAULT.POLICY”
• Use this or create custom policy based on this.
• Read Websphere MQ Manuals to understand the Meaning of each
of these fields in the messages.
• "informix".pubsub
• Used to specify service names, end points for publish and subscribe
functions.
20
09/07/2005
© 2004 IBM Corporation
IBM Software Group / Information Management
IDS MQ Tables
CREATE TABLE "informix".mqipubsub
(pubsubname LVARCHAR(256) NOT NULL UNIQUE,
servicebroker LVARCHAR(256),
receiver LVARCHAR(256) default ’ ’,
psstream LVARCHAR(256) default ’ ’,
pubsubtype VARCHAR(20) CHECK (pubsubtype IN (’Publisher’,
’Subscriber’)), FOREIGN KEY (servicebroker) REFERENCES
"informix".mqiservice(servicename));
pubsubname is the name of the publish/subscribe service.
servicebroker is the service name of the publish/subscribe service.
receiver is the queue on which to receive messages after subscription.
psstream is the stream coordinating the publish/subscribe service.
pubsubtype is the service type.
21
09/07/2005
© 2004 IBM Corporation
IBM Software Group / Information Management
2-phase commit with IDS and the MQ Functions
• Standard commit, rollback operations can be done on MQ operations.
•IDS manages the transaction and implement 2-phase commit protocol.
• MQ participates in the IDS transaction whenever MQ UDR is invoked.
• MQ will be a resource manager.
• IDS can manage distributed queries and MQ in the same transaction.
22
09/07/2005
© 2004 IBM Corporation
IBM Software Group / Information Management
http://publib.boulder.ibm.com/infocenter/ids9help
http://www.ibm.com/software/data/informix
23
09/07/2005
© 2004 IBM Corporation
IBM Software Group / Information Management
http://www.ibm.com/software/data/informix
24
09/07/2005
© 2004 IBM Corporation
© Copyright 2026 Paperzz