The following code example is the transport portion of an ODL application.
static int clotFunc(int mode, string queue, blob *sourceData, Blob *destData);
//MQSeries Transport Properties
string NNMQS_TIL_GET_OPTIONS;
string NNMQS_TIL_GET_MATCH_OPTIONS;
string NNMQS_TIL_GET_MATCH_MSG_ID;
string NNMQS_TIL_GET_MATCH_CORREL_ID;
string NNMQS_TIL_OPEN_QMGR;
string NNMQS_TIL_OPEN_OPTIONS;
string NNMQS_TIL_DYN_Q_NAME;
string NNMQS_TIL_PUT_OPTIONS;
string NNMQS_TIL_GET_MAP_AG_FRM_MD;
string NNMQS_TIL_GET_MAP_MT_FRM_MD;
//Generic message properties
string NNOT_MSG_CORREL_ID;
string NNOT_MSG_EXPIRATION;
string NNOT_MSG_ID;
string NNOT_MSG_PERSISTENCE;
string NNOT_MSG_MSG_PRIORITY;
//MQ Series Message Properties PUT and GET properties
string NNMQS_MSG_ACCOUNTING_TOKEN;
string NNMQS_MSG_APPL_IDENTITY_DATA;
string NNMQS_MSG_APPL_ORIGIN_DATA;
string NNMQS_MSG_BACKOUT_COUNT;
string NNMQS_MSG_CODED_CHAR_SET_ID;
string NNMQS_MSG_MSG_ENCODING;
string NNMQS_MSG_FEEDBACK;
string NNMQS_MSG_FLAGS;
string NNMQS_MSG_FORMATS;
string NNMQS_MSG_GROUP_ID;
string NNMQS_MSG_OFFSET;
string NNMQS_MSG_ORIGINAL_LENGTH;
string NNMQS_MSG_PUT_APPL_NAME;
string NNMQS_MSG_PUT_APPL_TYPE;
string NNMQS_MSG_PUT_DATE;
string NNMQS_MSG_PUT_TIME;
string NNMQS_MSG_REPLY_TO_Q;
string NNMQS_MSG_REPLY_TO_QMGR;
string NNMQS_MSG_MSG_REPORT;
string NNMQS_MSG_SEQUENCE_NUMBER;
string NNMQS_MSG_TYPE;
string NNMQS_MSG_USER_IDENTIFIER;
//Rules Formatter Specific Properties
string OPT_APP_GRP;
string OPT_MSG_TYPE;
//Session configuration Properties
string NN_TIL_SES_MQS_OPEN_QMGR;
string NNOT_SHARED_LIBRARY;
string NNOT_FACTORY_FUNCTION;
string NNOT_TIL_OPEN_SESSION_ID;
string NNOT_TIL_OPEN_TSI;
string NNOT_TIL_GET_BLOCKING_TIMEOUT;
string NNOT_BLOCK_INFINITE;
clot ot00;
clot ot01;
static int clotobjFunc(int mode, string queue, blob *sourceData, blob*destData)
{
int rv;
//if mode==1, then PUT if mode == 2, then GET
if(mode==1)
{
//***->MQSeries Transport Properties
NNMQS_TIL_GET_OPTIONS =””;
NNMQS_TIL_OPEN_OPTIONS = “MQOO_PASS_ALL_CONTEXT|MQOO_FAIL_IF_QUIESCING”;
NNMQS_TIL_PUT_OPTIONS = “MQPMO_SYNCPOINT|MQPMO_PASS_ALL_CONTEXT|MQPMO_FAIL_IF_QUIESCING”;
|MQPMO_NEW_MSG_ID|MQPMO_NEW_CORREL_ID;
//***->MQSeries Message Properties
NNMQS_MSG_REPLY_TO_Q = “REPLY”;
NNMQS_MSG_REPLY_TO_Q_MGR = “QMCLOT”;
NNMQS_MSG_TYPE = “MQMT_DATAGRAM”;
NNMQS_MSG_MSG_REPORT = “MQMT_REPORT”
//***->Rules Formatter Specific Properties
OPT_APP_GRP = “IMPACT_APP_GRP”
OPT_MSG_TYPE = “IMPACT_MSG”
//Add transport properties
ot00.addProp(OT_PROP_TRANSPORT, “NNOT_TIL_OPEN_TSI”, queue);
//Create context
ot00.create(“CLOTOBJ_CON)”;
//Open transport
ot00.open(“CLOTOBJ_TRAN”);
//Set data
ot00.setData(destData);
//add put properties
ot00.addProp(OT_PROP_PUT, “NNMQS_MSG_REPLY_TO_Q_MGR”, NNMQS_MSG_REPLY_TO_Q_MGR);
ot00.addProp(OT_PROP_PUT, “NNMQS_MSG_REPLY_TO_Q”, NNMQS_MSG_REPLY_TO_Q);
ot00.addProp(OT_PROP_PUT, “NNMQS_MSG_TYPE”, NNMQS_MSG_TYPR);
ot00.addProp(OT_PROP_PUT, “NNMQS_MSG_MSG_REPORT”, NNMQS_MSG_MSG_REPORT)’
ot00.addProp(OT_PROP_PUT, “NNMQS_TIL_PUT_OPTIONS”, NNMQS_TIL_PUT_OPTIONS);
//Begin transaction
ot00.begin();
//Put data to queue
ot00.put();
//commit transaction
ot00.commit();
//close transport
ot00.close();
}
else
if(mode==2)
{
//***->MQSeries Message Properties
NNMQS_MSG_REPLY_TO_Q = “REPLY”;
NNMQS_MSG_REPLY_TO_Q_MGR = “QMCLOT”;
NNMQS_TIL_OPEN_QMGR = “QMCLOT”;
NNMQS_MSG_TYPE = “MQMT_REQUEST”;
NNMQS_MSG_REPLY = “MQMT_REPLY”;
NNMQS_MSG_MSG_REPORT = “MQMT_REPORT”;
NNMQS_TIL_OPEN_QMGR = “QMCLOT”;
//Add transport props
ot01.addProp(OT_PROP_TRANSPORT, “NNOT_TIL_OPEN_TSI”, queue);
//Create context
ot01.create(“CLOTOBJ_CON”);
//Set data
ot01.open(“CLOTOBJ_TRAN”);
//Begin transaction
ot01.begin();
//Get data from queue
rv = ot01.get();
//get data from clot
ot01.getData(sourceData);
//commit transaction
ot01.commit();
//close transport
ot01.close();
}
return 1;
}
See the MQSeries Driver for Open Transport
Configuration Guide, MQRFH2 Support, for detailed information
on accessing information in an MQSeries header.
Copyright © 2005. Sybase Inc. All rights reserved. |
![]() |