4. shippingreq Order Entry Application Transaction Manager Shipping Application Websphere MQ creditque Database program for App to IDS interaction MQI or JMS program for app to MQ interaction Programming for Transaction co-ordination Between MQ and IDS Informix Dynamic Server Credit processing BEFORE recvdnotify Inventory
5. shippingreq Order Entry Application Shipping Application Websphere MQ creditque Informix Dynamic Server MQ Functions Transaction mgmt Simplified Interface SQL based program SQL based MQ access 2-phase commit Credit processing AFTER recvdnotify Inventory
6.
7. MQ Series Scenario Websphere MQ Q1… Q2… Informix Dynamic Server MQ-DB2 database module Z/OS DB2 on Z/OS Direct interaction using MQ Functions App-1 App-2 MQ Functions App-3 Transaction Manager App-4
8. IDS database server IDS client IDS client IDS client Orders_queue Inventory_queue backorder_queue IDS XA Transaction manager Infrastructure MQ Queue MQ Queue Manager MQ Message Broker MQ Functions Acme_queue_manager M Q I MQSeries UDR and XA support UDRs [xa_open, xa_commit, xa_rollback, etc] Websphere MQ IDS MQ Integration
9.
10. Usage begin work; -- read message with corrid execute function mqread ('IDS.DEFAULT.SERVICE', 'IDS.DEFAULT.POLICY', 'QA_MQ_ID_1'); -- receive message with corrid execute function mqreceive ('IDS.DEFAULT.SERVICE', 'IDS.DEFAULT.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; MQ Service MQ Policy Correlation ID Transactional Boundary ROLLBACK
11.
12.
13. Usage of MQ clob functions begin work; -- send/read/receive message using IDS.DEFAULT.SERVICE, IDS.DEFAULT.POLICY execute function mqsend (‘Hello'); execute function mqread (); execute function mqreceive() ; commit work; begin work; -- send a clob to MQ Queue execute function mqsendclob('IDS.DEFAULT.SERVICE', 'IDS.DEFAULT.POLICY', filetoclob("/etc/passwd", "client")); -- read message in clob using IDS.DEFAULT.POLICY execute function mqreadclob('IDS.DEFAULT.SERVICE‘); -- receive message in clob using IDS.DEFAULT.SERVICE, IDS.DEFAULT.POLICY execute function mqreceiveclob(); commit work;
14. Usage of MQSubscribe/MQPublish begin work; -- SubScribe a topic using IDS.DEFAULT.PUB.SUB.POLICY execute function mqSubscribe('IDS.DEFAULT.SUBSCRIBER',"Weather"); commit work; begin work; -- Publish a topic using IDS.DEFAULT.PUB.SUB.POLICY execute function mqPublish('IDS.DEFAULT.PUBLISHER', "Raining in San Francisco","Weather"); commit work; begin work; -- Publish a clob topic using IDS.DEFAULT.PUB.SUB.POLICY execute function mqPublishClob('IDS.DEFAULT.PUBLISHER', filetocolb(“weather_report_90210”,”client”), "Weather"); commit work;
15. Usage of mqUnSubscribe begin work; -- receive published topic execute function mqreceive('IDS.DEFAULT.SUBSCRIBER.RECEIVER', 'IDS.DEFAULT.PUB.SUB.POLICY'); commit work; begin work; -- Unsubscribe topic execute function mqUnSubscribe('IDS.DEFAULT.SUBSCRIBER',"Weather"); commit work;
19. MQTrace To enable trace by inserting a record into the systemtraceclasses system catalog insert into informix.systraceclasses(name) values ('idsmq') ; EXECUTE PROCEDURE MQTrace(50, '/tmp/trace.log'); begin; EXECUTE FUNCTION MQSend('IDS'); commit; Sample Trace (/tmp/trace.log): 14:19:38 Trace ON level : 50 14:19:47 >>ENTER : mqSend<< 14:19:47 status:corrid is null 14:19:47 >>ENTER : MqOpen<< 14:19:47 status:MqOpen @ build_get_mq_cache() 14:19:47 >>ENTER : build_get_mq_cache<<
20.
21.
22.
23. 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
24.
25. 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.