240 likes | 349 Views
Jerry Keesee, Director of the Informix lab Keshava Murthy, IDS Architect. IDS and Websphere MQ Integration. Agenda. Websphere MQ IDS Support for MQ MQ Functions 2-phase commit support Platforms Q & A. Webspher MQ. Websphere MQ Scenario. Websphere MQ. Informix Dynamic Server.
E N D
Jerry Keesee, Director of the Informix lab Keshava Murthy, IDS Architect IDS and Websphere MQ Integration
Agenda • Websphere MQ • IDS Support for MQ • MQ Functions • 2-phase commit support • Platforms • Q & A
Websphere MQ Scenario Websphere MQ Informix Dynamic Server Q1… Q2… Transaction Manager Application
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
Websphere MQ Scenario Informix Dynamic Server Websphere MQ Q1… Q2… MQ Functions Application Application
Direct interaction using MQ Functions MQ Series Scenario App-4 App-3 Z/OS Informix Dynamic Server Websphere MQ MQ Functions DB2 on Z/OS Q1… Q2… MQ-DB2 database module Transaction Manager App-1 App-2
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 MQSeries UDR and XA support UDRs [xa_open, xa_commit, xa_rollback, etc] Orders_queue IDS client M Q I backorder_queue IDS client MQ Queue
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
Usage MQ Policy MQ Service begin work; -- read message with corrid execute function mqread('IDS.SAMPLE.SERVICE', 'IDS.SAMPLE.POLICY', 'QA_MQ_ID_1'); -- receive message with corrid execute function mqreceive('IDS.SAMPLE.SERVICE', 'IDS.SAMPLE.POLICY', 'QA_MQ_ID_1'); commit work; begin work; -- receives 10 orders from the ORDER queue INSERT INTO ordertab SELECT FIRST 10 MQRECEIVE(‘MY.ORDER’) from systables; rollback work; -- insert rows begin work; SELECT MQSEND(‘NEW.ORDER’, order || ‘:’ || address FROM tab WHERE cno = 12345; Commit work; Correlation ID Transactional Boundary ROLLBACK
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. begin work; execute function MQCreateVTIREAD(“myreadtable“, “service”, “policy”, 4096); commit work; Select first 10 * from myreadtable; Insert into myreadtable values(“IBM:81.98;Volume:1020”); Table Name Max message size
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;
MQCreateVtiReceive 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");
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)
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)
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 Data Blade MQSeries UDR and XA support UDRs [xa_open, xa_commit, xa_rollback, etc] Orders_queue IDS client M Q I backorder_queue IDS client MQ Queue
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. • Using MQ Functions require WebSphere MQ Server installation on the same machine where IDS running.
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.
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.
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.
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.
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.
http://publib.boulder.ibm.com/infocenter/ids9help http://www.ibm.com/software/data/informix