Slides - International Informix Users Group

24
IDS and Websphere MQ Integration Jerry Keesee, Director of the Informix lab Keshava Murthy, IDS Architect

Transcript of Slides - International Informix Users Group

Page 1: Slides - International Informix Users Group

IDS and Websphere MQ Integration

Jerry Keesee, Director of the Informix labKeshava Murthy, IDS Architect

Page 2: Slides - International Informix Users Group

IBM Software Group / Information Management

© 2004 IBM Corporation2 09/07/2005

AgendaAgenda

Websphere MQ

IDS Support for MQ

MQ Functions

2-phase commit support

Platforms

Q & A

Websphere MQ

IDS Support for MQ

MQ Functions

2-phase commit support

Platforms

Q & A

Page 3: Slides - International Informix Users Group

IBM Software Group / Information Management

© 2004 IBM Corporation3 09/07/2005

Webspher MQ

Page 4: Slides - International Informix Users Group

IBM Software Group / Information Management

© 2004 IBM Corporation4 09/07/2005

Websphere MQ Scenario

Websphere MQ

Websphere MQ

Q1…Q1…

Q2…Q2…

Informix Dynamic ServerInformix Dynamic Server

ApplicationApplication

Transaction ManagerTransaction Manager

Page 5: Slides - International Informix Users Group

IBM Software Group / Information Management

© 2004 IBM Corporation5 09/07/2005

IDS and MQOverview

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

Page 6: Slides - International Informix Users Group

IBM Software Group / Information Management

© 2004 IBM Corporation6 09/07/2005

Websphere MQ Scenario

Websphere MQ

Websphere MQ

Q1…Q1…

Q2…Q2…

ApplicationApplication

MQ FunctionsMQ Functions

Informix Dynamic ServerInformix Dynamic Server

ApplicationApplication

Page 7: Slides - International Informix Users Group

IBM Software Group / Information Management

© 2004 IBM Corporation7 09/07/2005

MQ Series Scenario

Websphere MQ

Websphere MQ

Q1…Q1…

Q2…Q2…

Informix Dynamic ServerInformix Dynamic Server

MQ-DB2 database module

MQ-DB2 database module

Z/OSZ/OS

DB2 on Z/OSDB2 on Z/OS

Direct interaction using MQ Functions

Direct interaction using MQ Functions

App-1App-1 App-2App-2

MQ FunctionsMQ Functions

App-3App-3

Transaction ManagerTransaction Manager

App-4App-4

Page 8: Slides - International Informix Users Group

IBM Software Group / Information Management

© 2004 IBM Corporation8 09/07/2005

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 Functio

ns

Acme_queue_manager

MQI

MQSeries UDR and XA support UDRs [xa_open, xa_commit, xa_rollback, etc]

Websphere MQ

IDS MQ Integration

Page 9: Slides - International Informix Users Group

IBM Software Group / Information Management

© 2004 IBM Corporation9 09/07/2005

• 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

• 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

IDS MQ Functions

Page 10: Slides - International Informix Users Group

IBM Software Group / Information Management

© 2004 IBM Corporation10 09/07/2005

Usagebegin work;-- read message with corridexecute function mqread('IDS.SAMPLE.SERVICE', 'IDS.SAMPLE.POLICY', 'QA_MQ_ID_1');

-- receive message with corridexecute function mqreceive('IDS.SAMPLE.SERVICE', 'IDS.SAMPLE.POLICY', 'QA_MQ_ID_1');commit work;

begin work;-- receives 10 orders from the ORDER queueINSERT INTO ordertab SELECT FIRST 10 MQRECEIVE(‘MY.ORDER’) from systables;rollback work;-- insert rowsbegin work;SELECT MQSEND(‘NEW.ORDER’, order || ‘:’ || addressFROM tab WHERE cno = 12345;Commit work;

MQ Service MQ Policy

Correlation ID

Transactional Boundary

ROLLBACK

Page 11: Slides - International Informix Users Group

IBM Software Group / Information Management

© 2004 IBM Corporation11 09/07/2005

• 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”);

MQCreateVtiRead

Table Name

Max message

size

Page 12: Slides - International Informix Users Group

IBM Software Group / Information Management

© 2004 IBM Corporation12 09/07/2005

• 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 rowsbegin work;insert into mqvtitable(msg) values ("IBM:81.23;Volume:10100");Commit work;

MQCreateVtiReceive

Page 13: Slides - International Informix Users Group

IBM Software Group / Information Management

© 2004 IBM Corporation13 09/07/2005

MQCreateVtiReceivecreate 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");

Page 14: Slides - International Informix Users Group

IBM Software Group / Information Management

© 2004 IBM Corporation14 09/07/2005

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)

Page 15: Slides - International Informix Users Group

IBM Software Group / Information Management

© 2004 IBM Corporation15 09/07/2005

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)

Page 16: Slides - International Informix Users Group

IBM Software Group / Information Management

© 2004 IBM Corporation16 09/07/2005

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 Data Blade

Acme_queue_manager

MQI

MQSeries UDR and XA support UDRs [xa_open, xa_commit, xa_rollback, etc]

Websphere MQ

MQ Integration

Page 17: Slides - International Informix Users Group

IBM Software Group / Information Management

© 2004 IBM Corporation17 09/07/2005

• 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.

Page 18: Slides - International Informix Users Group

IBM Software Group / Information Management

© 2004 IBM Corporation18 09/07/2005

• 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.

Page 19: Slides - International Informix Users Group

IBM Software Group / Information Management

© 2004 IBM Corporation19 09/07/2005

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

Page 20: Slides - International Informix Users Group

IBM Software Group / Information Management

© 2004 IBM Corporation20 09/07/2005

• "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

Page 21: Slides - International Informix Users Group

IBM Software Group / Information Management

© 2004 IBM Corporation21 09/07/2005

IDS MQ TablesCREATE 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.

Page 22: Slides - International Informix Users Group

IBM Software Group / Information Management

© 2004 IBM Corporation22 09/07/2005

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.

Page 23: Slides - International Informix Users Group

IBM Software Group / Information Management

© 2004 IBM Corporation23 09/07/2005

http://www.ibm.com/software/data/informix

http://publib.boulder.ibm.com/infocenter/ids9help

Page 24: Slides - International Informix Users Group

IBM Software Group / Information Management

© 2004 IBM Corporation24 09/07/2005

http://www.ibm.com/software/data/informix