4 AMI AMI AMI SC345604 89
4.1 AMI MQSeries API AMI MQI AMI / / AMI JavaC C++ AMI / AMI AMI - / / 91 41-90
41 AMI - AMI - - API MQI MQSeries MQI AMI IBM 91
MQSeries REPOSITORY AMI AMI AMI XML Windows AMI service point ORDERS MQSeries AMI SupportPac MA0Ffor Windows NT 92 Windows NT 4.0 Windows 2000 IBM MQSeries AMI>IBM MQSeries AMI Administration Tool Windows
\amt\amitool\amitool.bat 42 AMI 42 AMI AMI MQSeries MQSeries 93
AMI AMI AMI MQSeries API MQIMQSeries Classes for JavaActiveX MQSeries / WebSphere MQ Integrator AMI / / MQSeries API AMIAMI SupportPac MA0F IBM http://www.ibm.com/software/ts/mqseries/txppacs/ AMI / MQSeries Publish/Subscribe SupportPac MA0C 4.2 4.1 90 AMI CC++ Java Windows NT Windows 2000 AIX 4.3 Sun Solaris 2.6 2.7 HPUX 11.0 AS/400 4R4 AMI COBOL OS/390 2R6 CICS 4.1 IMS 5.1 AMI 94 C COBOL OS/390 AMI
Java C++ / C C C AMI 41 C API - 41 C - #include <stdio.h> #include <stdlib.h> #include <string.h> #include <amtc.h> #include <time.h> int mainvoid { /* */ hsession amsescreatesample_session_name, &compcode, &reason hpol amsescreatepolicyhsession, SAMPLE_POLICY_NAME, &compcode, &reason hsender amsescreatesenderhsession, SAMPLE_SENDER_NAME, &compcode, &reason success amsesopenhsession, hpol, &compcode, &reason success amsndopenhsender, hpol, &compcode, &reason success amsndsendhsender, hpol, AMH_NULL_HANDLE, AMH_NULL_HANDLE, strlensamplemsg, unsigned char *samplemsg, AMH_NULL_HANDLE, &compcode, &reason success amsesdelete&hsession, &compcode, &reason endsampleexit_success } 42 41 - Java API 42 Java - import java.util.* import com.ibm.mq.amt.*... public void main { mysessionfactory new AmSessionFactory mysession mysessionfactory.createsessionsample_session_name mypolicy mysession.createpolicysample_policy_name 95
} mysender mysession.createsendersample_sender_name mysendmsg mysession.createmessagesample_message_name mysession.openmypolicy mysender.openmypolicy String samplemessage new String"Sample message" mysendmsg.writebytessamplemessage.getbytes mysender.sendmysendmsg mysender.closemypolicy mysession.closemypolicy 4.3 AMI AMI C AMI amtc.h AMI #include <amtc.h> 41 AMI amtc.h 41 AMI C AS400 QMQAMI/H UNIX AIX, HPUX Solaris {MQSeries }/amt/inc Windows OS/390 {MQSeries }\amt\include hlq.scsqc370 amtc.h C++ AMI amtcpp.hpp C++ C amtcpp.hpp #include<amtcpp.hpp> 96
42 amtcpp.hpp AMI 42 AMI C++ AS/400 UNIX AIXHPUX Solaris Windows QMQAMI/H {MQSeries }/amt/inc {MQSeries }\amt\include amtcpp.hpp amtc.h amtcpp.hpp Java API AMI AMI package for Java JAR Java com.ibm.mq.amt Java JAR com.ibm.mq.amt.jar AMI package for Java import com.ibm.mq.amt.* JAR CLASSPATH Java 43 AMI JAR AMI 43 AMI Java JAR AS/400 /QIBM/ProdData/mqm/amt/Java/lib UNIX AIXHPUX Solaris{MQSeries }/java/lib Windows {MQSeries }\java\lib COBOL AMI copybooks AMTV AMTELEML AMELEM AMI 97
AMTELEMV AMTELEML AMTELEMV OS/390 hlq.scsqcobc MQSeries AMTELEMV AMELEM strucid version AMI 44 AMI CCOBOLC++ Java 44 AIX OS/400 HPUX OS/390 Sun Solaris C++ 5.0 VisualAge JDK 1.1.7 Java5769JV1 AS/400 Developer Kit AS/4005769CX2 ILE C AS/4005799GDW ILE C++ C++ for 0S/4005716CX4 Visual Age HP ac++ B3910B A.03.10 HP ac++ B3910B A.03.04970930 JDK 1.1.7 OS/390 C/C++ 2 6 OS/390 & VM 2 1 IBM COBOL MVS VM 1 2 IBM COBOL Workshop Compiler 4.2 Solaris 2.6 Workshop Compiler 5.0 Solaris 7 JDK 1.1.7 Windows Microsoft Visual C++ Version 6 JDK 1.1.7 AMI MQSeries 4.4 98 AMI
AMI MQOD MQOD / / 43 AMI 99
43 AMI AMI C++Java Helper and Exception objects 100
4.5 AMI AMI 3 Java AMI 4.5.1 MQSeries API AMI Java C++Java SessionFactoryObject new AmSessionFactoryString factoryname FactoryName C:\Program Files\MQSeries\amt AMT_DATA_PATH MQSeries AMI SupportPacMA0F AmSessionFactory createsession mysessionfactory.createsessionstring sessionname sessionname MQSeries MQI 23 MQI API MQCONN AMI {MQSeries }/amt amthost.xml 43 ITSOH defaultconnection 101
43 <?xml version 1.0encoding UTF8?> <queuemanagersnames defaultconnection ITSOH connectionname1 queuemanagername1connectionname2 queuemanagername2/> 44 AmSessionFactory ITSO AmSession 44 private AmSessionFactory mysessionfactory null private AmSession mysession null // // Since we are not specifying a name for the AmSessionFactory, // we expect the AMI files to be stored in the default AMI // location. // mysessionfactory new AmSessionFactory mysession mysessionfactory.createsessionitso AMI 1. 2. 3. / / / / 4. 4.5.2 MQSeries / AMI AmSession createpolicy sessionobject.createpolicystring policyname 102
policyname 45 AMT.SAMPLE.POLICY AMT.SAMPLE.POLICY 45 public static void main { AmSessionFactory mysessionfactory null AmSession mysession null AmPolicy mypolicy null mysessionfactory new AmSessionFactory mysession mysessionfactory.createsessionitso.session.name mypolicy mysession.createpolicyamt.sample.policy } / createsender sessionobject.createsenderstring sendername sendername 46 AMT.SENDER.NAME 46 AmSessionFactory mysessionfactory null AmSession mysession null AmPolicy mypolicy null 103
mysessionfactory new AmSessionFactory mysession mysessionfactory.createsessionitso.session.name mypolicy mysession.createpolicyamt.sample.policy mysender mysession.createsenderamt.sender.name createreceiver sessionobject.createreceiverstring receivername receivername 47 AMT.RECEIVER.NAME 47 AmSessionFactory mysessionfactory null AmSession mysession null AmPolicy mypolicy null AmReceiver myreceiver null mysessionfactory new AmSessionFactory mysession mysessionfactory.createsessionitso.session.name mypolicy mysession.createpolicyamt.sample.policy myreceiver mysession.createreceiveramt.receiver.name createpublisher sessionobject.createpublisherstring publishername publishername MQRFH MQRFH / / 48 AMT.PUBLISHER.NAME 104
48 AmSessionFactory AmSession AmPolicy AmPublisher mysessionfactory null mysession null mypolicy null mypublisher null mysessionfactory new AmSessionFactory mysession mysessionfactory.createsessionitso.session.name mypolicy mysession.createpolicyamt.sample.policy mypublisher mysession.createpublisheramt.publisher.name createsubscriber sessionobject.createsubscriberstring subscribername subscribername 47 AMT.SAMPLE.SUBSCRIBER 49 public static void main {... AmSessionFactory mysessionfactory null AmSession mysession null AmPolicy mypolicy null mysessionfactory new AmSessionFactory mysession mysessionfactory.createsessionitso.session.name mypolicy mysession.createpolicyamt.sample.policy mysubscriber mysession.createsubscriberamt.sample.subscriber } 105
createdistributionlist sessionobject.createdistributionliststring distributionlistname 410 410 public static void main { AmSessionFactory mysessionfactory null AmSession mysession null AmPolicy mypolicy null mysessionfactory new AmSessionFactory mysession mysessionfactory.createsessionitso.session.name mypolicy mysession.createpolicyamt.sample.policy mysender mysession.createdistributionlistamt.distribution.list } 44 AMT.DISTRIBUTION.LIST 106
44 AMT.DISTRIBUTION.LIST AmSession createmessage AmSession.createMessageString messagename MessageName 411 ITSO.SAMPLE.MESSAGE.NAME 411 public static void main { AmSessionFactory mysessionfactory null AmSession mysession null 107
AmPolicy AmPolicy AmMessage mypolicy null mypolicy null mysendmsg null mysessionfactory new AmSessionFactory mysession mysessionfactory.createsessionitso.session.name mypolicy mysession.createpolicyamt.sample.policy mysender mysession.createsenderamt.sender_name mysendmsg mysession.createmessageitso.sample.message.name } open open 102 AmSession createpolicy AmSession.openAmPolicy policyobject AmSender.openAmPolicy policyobject AmReceiver.open AmPolicy policyobject AmPublisher.openAmPolicy policyobject AmSubscriber.openAmPolicy policyobject 412 412 Open the session factory Create the required objects session, publisher, message, etc. /... mypolicy mysession.createpolicyamt.sample.policy mysession.openmypolicy mypublisher.openmypolicy myrespreceiver.openmypolicy 108
4.5.3 4.5.2 MQSeries 102 MQSeries MQI MQI MQOO_INPUT_SHARED, MQOO_OUTPUT AMI send Java getbytes Java writebytes senderobject.sendammessage messageobject, AmReceiver receiverobject/ammessage receivedmessage, AmPolicy policyobject / 413 413 public static void main { 109
AmSessionFactory AmSession AmPolicy AmSender AmMessage mysessionfactory null mysession null mypolicy null mysender null mysendmsg null mysessionfactory new AmSessionFactory mysession mysessionfactory.createsessionitso.session.name mypolicy mysession.createpolicyamt.sample.policy mysender mysession.createsenderamt.sender_name mysendmsg mysession.createmessageitso.sample.message.name String samplemessage new String"Sample message" mysendmsg.writebytessamplemessage.getbytes mysender.sendmysendmsg } distributionlist send 4.5.2 MQSeries 102 414 414 public static void main { AmSessionFactory mysessionfactory null AmSession mysession null AmPolicy mypolicy null AmDistributionList mydistributionlst null AmMessage mysendmsg null mysessionfactory new AmSessionFactory mysession mysessionfactory.createsessionitso.session.name mypolicy mysession.createpolicyamt.sample.policy mydistributionlst mysession.createdistributionlistitso.distribution.list mysendmsg mysession.createmessageitso.sample.message.name String samplemessage new String"Sample message" mysendmsg.writebytessamplemessage.getbytes mydistributionlist.sendmysendmsg } receive amreceiver.receiveammessage messageobject, AmSender senderobject, AmMessage selectionmessageobject, AmPolicy policyobject 110
4 messageobject senderobject PolicyObject IDcorrelation ID selectionmessageobject readbytes 415 415 public static void main { AmSessionFactory mysessionfactory null AmSession mysession null AmPolicy mypolicy null AmReceiver myreceiver null AmMessage myreceivemsg null AmMessage mysendmsg null mysessionfactory new AmSessionFactory mysession mysessionfactory.createsessionitso.session.name mypolicy mysession.createpolicyitso.sample.policy myreceivemsg mysession.createmessageitso.sample.message.name myreceiver.receivemyreceivemsg String samplemessage new StringMyReceiveMSG.readbytesmyReceiveMSG.getDataLength } addtopic messageobject.addtopicstring topicname topicname 111
publish publisherobject.publishammessage messageobject, AmReceiver receiverobject, AmPolicy policyobject messageobject implicit registration receiverobject MessageObject policyobject 416 policyobject receiverobject 416 Create and open required objects session, policy, message and publisher string pubmessage SUNNY mysendmsg.addtopicweather mysendmsg.writebytespubmessage.getbytes mypublisher.publishmysendmsg addtopic messageobject.addtopicstring topicname topicname subscribe 112
subscriberobject.subscribeammessage messageobject, AmReceiver receiverobject, AmPolicy policyobject messageobject addtopic receiverobject receive PolicyObject receiverobject receive subscriberobject.receiveammessage messageobject, AmMessage selectionmessageobject, AmPolicy policyobject messageobject ID selectionmessageobject PolicyObject unsubscribe subscribeobject.unsubscribeammessage messageobject, AmReceiver receiverobject, AmPolicy policyobject messageobject receiverobject 4 17 417 113
int icounter 0 String topic Weather mysendmsg.addtopicweather mysubscriber.subscribemysendmsg, mypolicy // Only 5 messages are expected for icounter 0iCounter < 5iCounter++ mysubscriber.receivemyreceivemsg, mypolicy String myrequest new StringmyReceiveMSG.readBytesmyReceiveMSG.getDataLength System.out.printlnmyRequest } // The application has received all the messages that it wanted so it proceeds // to send an unsubscribe request. mysubscriber.unsubscribemysendmsg, mypolicy 4.5.4 close subscriberobject.closeampolicy policy Object sessionobject.closeampolicy policy Object receiverobject.closeampolicy policy Object publisherobject.closeampolicy policy Object distributionlistobject.closeampolicy policy Object close policyobject MQSeries sessionobject sessionobject 114
4.6 AMIMQI MQSeries API AMI MQI MQI / AMI MQI MQSeries AMI MQSeries MQI CC++Java COBOL API AMI API MQI AMI MQI IBM AMI / API C++Java 4.7 AMI AMI General API MQSeries commit rollback 418 MQSeries 115
418 public static void main { AmSessionFactory mysessionfactory null AmSession mysession null AmPolicy mypolicy null AmReceiver myreceiver null AmMessage myreceivemsg null AmMessage mysendmsg null mysessionfactory new AmSessionFactory mysession mysessionfactory.createsessionitso.session.name mypolicy mysession.createpolicyitso.sample.policy myreceivemsg mysession.createmessageitso.sample.message.name myreceiver.receivemyreceivemsg // If no failures were found commit the action mysession.commitmypolicy String samplemessage new StringMyReceiveMSG.readbytesmyReceiveMSG.getDataLength // If some problems were found, dont retrieve the message mysession.rollbackmypolicy } MQSeries XA XA transaction coordinator AmSession begin AmSession commit AmSession rollback 419 MQSeries XA 419 MQSeries XA public static void main { AmSessionFactory mysessionfactory null AmSession mysession null AmPolicy mypolicy null AmSender mysender null AmMessage mysendmsg null // Connect to the database mysessionfactory new AmSessionFactory mysession mysessionfactory.createsessionitso.session.name mypolicy mysession.createpolicyamt.sample.policy mysender mysession.createsenderamt.sender_name 116
mysendmsg mysession.createmessageitso.sample.message.name mysession.beginmypolicy // Update a table. // If the update was successful then commit the action and send a message to // another application String samplemessage new String"Sample message" mysendmsg.writebytessamplemessage.getbytes mysender.sendmysendmsg mysession.commitmypolicy // If problems occurred during the update, backout the changes mysession.rollbackmypolicy } Tuxedo API AMI 4.8 AMI group context information group status information AMGRP_FIRST_MSG_IN_GROUP AMGRP_MIDDLEMSG_IN_GROUP AMGRP_LAST_MSG_IN_GRP setgroupstatus messageobject.setgroupstatusint groupstatus groupstatus AMGRP_MSG_NOT_IN_GROUP AMGRP_FIRST_MSG_IN_GRP AMGRP_MIDDLE_MSG_IN_GRP 117
AMGRP_LAST_MSG_IN_GROUP AMGRP_ONLY_MSG_IN_GROUP AMGRP_FIRST_MSG_IN_GROUP AMGRP_MIDDLE_MSG_IN_GRP 4.9 AMI 4.9.1 - - Java JVM MQSeries AMI Java 420 CLASSPATH JAR 118
420 import com.ibm.mq.amt.* AMI JAR - 421 421 private AmSessionFactory mysessionfactory null private AmSession mysession null private AmSender mysender null private AmMessage mysendmsg null private AmPolicy mypolicy null 422 mysessionfactory 421 422 mysessionfactory new AmSessionFactory createsession createpolicy createsender createmessage 4 23 SAMPLE_SESSION_NAME SAMPLE_POLICY_NAME SAMPLE_SENDER_NAME SAMPLE_MESSAGE_NAME 424 mysession mysessionfactory.createsessionsample_session_name mypolicy mysession.createpolicysample_policy_name mysender mysession.createsendersample_sender_name 119
mysendmsg mysession.createmessagesample_message_name 424 mysession mysender 424 mysession.openmypolicy mysender.openmypolicy send 4.5.3 109 Java getbytes Java writebytes 425 819 425 String samplemessage new String"Sample message" mysendmsg.setccsid819 mysendmsg.writebytessamplemessage.getbytes mysender.sendmysendmsg, mypolicy close 426 424 120 426 mysender.closemypolicy mysession.closemypolicy / / 120
writebytes waittime readbytes Java JVM MQSeries AMI Java classes 427 CLASSPATH JAR 427 import com.ibm.mq.amt.* AMI JAR / 428 428 private AmSessionFactory mysessionfactory null private AmSession mysession null private AmSender mysender null private AmReceiver myreceiver null private AmMessage mysendmsg null private AmMessage myreceivemsg null 121
private AmPolicy mypolicy null 429 mysessionfactory 428 429 mysessionfactory new AmSessionFactory createsessioncreatepolicycreatesendercreatereceiver createmessage 430 SMAPLE_SESSION_NAME SAMPLE_POLICY_NAME SAMPLE_SENDER_NAME SAMPLE_RECEIVER_NAME SAMPLE_SEND_MESSAGE_NAME SAMPLE_RECEIVE_MESSAGE_NAME 430 mysession mysessionfactory.createsession SAMPLE_SESSION_NAME mypolicy mysession.createpolicy SAMPLE_POLICY_NAME mysender mysession.createsender SAMPLE_SENDER_NAME myreceiver mysession.createreceiver SAMPLE_RECEIVER_NAME mysendmsg mysession.createmessage SAMPLE_SEND_MESSAGE_NAME myreceivemsg mysession.createmessage SAMPLE_RECEIVE_MESSAGE_NAME 431 mysession mysender myreceiver 431 mysession.openmypolicy mysender.openmypolicy myreceiver.openmypolicy 122
send 4.5.3 109 Java getbytes Java writebytes 432 819 432 String samplemessage "Sample message" mysendmsg.setccsid819 mysendmsg.writebytessamplemessage.getbytes mysender.sendmysendmsg, myreceiver, mypolicy setwaittime receive readbytes 433 2000 433 mypolicy.setwaittime2000 mysendmsg.setccsidamcp_819 myreceiver.receivemyreceivemsg, mysendmsg, mypolicy replymessage new StringmyReceiveMSG.readBytesmyReceiveMSG.getDataLength,"ISO8859_1" close close 434 431 434 mysender.closemypolicy myreceiver.closemypolicy mysession.closemypolicy 123
4.9.2 / addtopic writebytes Java JVM MQSeries AMI Java classes 435 CLASSPATH JAR 124
435 import com.ibm.mq.amt.* AMI JAR / 436 436 private AmSessionFactory mysessionfactory null private AmSession mysession null private AmPublisher mypublisher null private AmMessage mysendmsg null private AmMessage myrespmsg null private AmPolicy mypolicy null private AmReceiver myrespreceiver null 437 mysessionfactory 436 437 mysessionfactory new AmSessionFactory createsession createpolicy createsender createreceiver createmessage 438 SMAPLE_SESSION_NAME SAMPLE_POLICY_NAME SAMPLE_PUBLISHER_NAME SAMPLE_RESPONSE_NAME 125
SAMPLE_MESSAGE_NAME SAMPLE_RESP_MESSAGE_NAME 438 mysession mysessionfactory.createsession SAMPLE_SESSION_NAME mypolicy mysession.createpolicy SAMPLE_POLICY_NAME mypublisher mysession.createpublisher SAMPLE_PUBLISHER_NAME myrespreceiver mysession.createreceiver SAMPLE_RESPONSE_NAME mysendmsg mysession.createmessage SAMPLE_MESSAGE_NAME myrespmsg mysession.createmessage SAMPLE_RESP_MESSAGE_NAME 439 mysession mypublisher myrespreceiver 439 mysession.openmypolicy mypublisher.openmypolicy myrespreceiver.openmypolicy addtopic 440 438 CCSID mysendmsg myrespreceiver 440 String sunny "SUNNY again" String showers "WIND and SCATTERED showers" String rain "HEAVY RAIN" String outlook[] {sunny, showers, rain} for int i 0, j 0i < SAMPLE_MAX_PUBLICATIONSi++, j++ { try { mysendmsg.addtopic Weather if j 3 126
{ j 0 } String samplemessage new Stringoutlook[j] mysendmsg.setccsid819 mysendmsg.writebytessamplemessage.getbytes"iso8859_1" mypublisher.publishmysendmsg, myrespreceiver, mypolicy myrespreceiver.receivemyrespmsg, mysendmsg, mypolicy } } close close 441 439 441 mypublisher.closemypolicy myreceiver.closemypolicy mysession.closemypolicy addtopic 127
readbytes Java JVM MQSeries AMI Java classes 442 CLASSPATH JAR 442 import com.ibm.mq.amt.* AMI JAR 443 443 private AmSessionFactory mysessionfactory null private AmSession mysession null private AmSubscriber mysubscriber null private AmMessage mysendmsg null private AmMessage myreceivemsg null private AmPolicy mypolicy null 444 mysessionfactory 443 128
444 mysessionfactory new AmSessionFactory createsessioncreatepolicycreatesender createmessage 445 SMAPLE_SESSION_NAME SAMPLE_POLICY_NAME SAMPLE_SUBSCRIBER_NAME SAMPLE_RESPONSE_NAME SAMPLE_RECEIVE_MESSAGE_NAME SAMPLE_SEND_MESSAGE_NAME 445 mysessionfactory new AmSessionFactory mysession mysessionfactory.createsession SAMPLE_SESSION_NAME mypolicy mysession.createpolicy SAMPLE_POLICY_NAME mysubscriber mysession.createsubscriber SAMPLE_SUBSCRIBER_NAME myreceivemsg mysession.createmessage SAMPLE_RECEIVE_MESSAGE_NAME mysendmsg mysession.createmessage SAMPLE_SEND_MESSAGE_NAME 446 mysession mysubscriber 446 mysession.openmypolicy mysubscriber.openmypolicy 447 addtopic mysendmsg mysubscriber subscribe 447 String topic "Weather" Try 129
{ mysendmsg.reset mysendmsg.addtopictopic mysubscriber.subscribemysendmsg, mypolicy } mysubscriber receive readbytes 448 448 for i 0i < SAMPLE_MAX_PUBLICATIONSi++ { try { mysubscriber.receivemyreceivemsg, mypolicy String myrequest new StringmyReceiveMSG.readBytesmyReceiveMSG.getDataLength,"ISO8859_1" System.out.printlnmyRequest myreceivemsg.reset } } 449 mysubscriber unsubscribe 449 String topic "Weather" try { mysendmsg.reset mysendmsg.addtopictopic // // Send the request. //No response is expected so no receiver object is passed. // mysubscriber.unsubscribemysendmsg, mypolicy } 130
close close 450 446 129 450 mysubscriber.closemypolicy mysession.closemypolicy AMI MQSeries 131
132