IBM Software Group / Information Management
09/07/2005 © 2005 IBM Corporation
2
IBM Software Group / Information Management
09/07/2005 © 2004 IBM Corporation
IBM Software Group / Information Management
3 09/07/2005 © 2004 IBM Corporation
IBM Software Group / Information Management
Websphere MQ
Q1…
Q2…
4
Transaction Manager
Application
09/07/2005
Informix Dynamic Server
© 2004 IBM Corporation
IBM Software Group / Information Management
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
Q1…
Q2…
Informix Dynamic Server
MQ Functions
6
Application
09/07/2005
Application
© 2004 IBM Corporation
IBM Software Group / Information Management
MQ Series Scenario
Direct interaction using MQ Functions
Z/OS
DB2 on Z/OS
Websphere MQ
Q1…
Q2…
MQ-DB2 database module
7
App-4 App-3
Informix Dynamic Server
MQ Functions
App-1 App-2
09/07/2005
Transaction Manager
© 2004 IBM Corporation
IBM Software Group / Information Management
MQ Queue Manager
IDS client
IDS client
IDS client
IDS database server
IDS XA Transaction manager
Infrastructure
MQSeries UDR and XA support
UDRs [xa_open, xa_commit, xa_rollback, etc]
MQ
Functions
M
Q
I
Websphere MQ
Acme_queue_manager
Inventory_queue
Orders_queue backorder_queue
MQ Message Broker
MQ Queue
8 09/07/2005 © 2004 IBM Corporation
IBM Software Group / Information Management
• 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
9
• INSERT into these MQ tables will send the row to the QUEUE
• READ/RECEIVE from the table will retrieve msgs from the QUEUE
09/07/2005 © 2004 IBM Corporation
IBM Software Group / Information Management
MQ Service
MQ Policy 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 work;
-- insert rows
ROLLBACK 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
• 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 MQCreateVTI READ (“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
• 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 MQCreateVTI Receive (“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
create table myreceivetab
( msg lvarchar(maxMessage), correlid varchar(24), topic varchar(40), qname varchar(48), msgid 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
– 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
15
• 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)
09/07/2005 © 2004 IBM Corporation
IBM Software Group / Information Management
MQ Queue Manager
IDS client
IDS client
IDS client
IDS database server
IDS XA Transaction manager Infrastructure
MQSeries UDR and XA support
UDRs [xa_open, xa_commit, xa_rollback, etc]
MQ
Data
Blade
M
Q
I
Websphere MQ
Acme_queue_manager
Inventory_queue
Orders_queue backorder_queue
MQ Message Broker
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.
• Solaris 32bit
• HPUX 32bit
• AIX 32bit
• Windows 32bit
– Please provide feedback on Platform Requirement.
17
– 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
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
• "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
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
• 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
23 http://publib.boulder.ibm.com/infocenter/ids9help http://www.ibm.com/software/data/informix
09/07/2005 © 2004 IBM Corporation
IBM Software Group / Information Management
24 http://www.ibm.com/software/data/informix
09/07/2005 © 2004 IBM Corporation