Examples - using MAttribute for C

    /* putMessage */
   MQeMsgAttrHndl    hAttr = NULL;
   MQeStringHndl     hKeySeed = NULL, hQMgrName =
            NULL, hQName = NULL;
   MQeStringHndl     hFieldName = NULL, hFieldData = NULL;
   MQeExceptBlock    exceptBlock;
   MQeFieldsHndl     hData = NULL;
   MQeQueueManagerHndl hQMgr = NULL;
   MQERETURN rc;

   ...
   /* assume queue manager handle in hQMgr,
  /*QMgr name in hQMgrName, and queue name in hQName */

   /* create a key seed string */
   rc = mqeString_newChar8(&exceptBlock, &hKeySeed,
            "my secret key");
   /* create a new attribute with a RC4 cryptor */
   rc = mqeMsgAttr_new(&exceptBlock, &hAttr, NULL,
            MQE_RC4_CRYPTOR_CLASS_NAME,
            NULL, hKeySeed);
   /* create a data Fields */
   rc = mqeFields_new(&exceptBlock, &hData);
   /* add some test data */
   rc = mqeString_newChar8(&exceptBlock, &hFieldName
            "MsgData");
   rc = mqeString_newChar8(&exceptBlock, &hFieldData
            "0123456789abcdef....");
   rc = mqeFields_putAscii(hData, &exceptBlock,
            hFieldName, hFieldData);
   /* send message */
   rc = mqeQueueManager_putMessage(hQMgr, &exceptBlock,
            hQMgrName, hQName,
            hData, hAttr, 0);

   /* getMessage */
   MQeMsgAttrHndl hAttr = NULL;
   MQeStringHndl     hKeySeed = NULL, hQMgrName =
            NULL, hQName = NULL;
   MQeStringHndl     hFieldName = NULL, hFieldData = NULL;
   MQeExceptBlock    exceptBlock;
   MQeQueueManagerHndl hQMgr = NULL;
   MQERETURN rc;

   ...
   /* assume queue manager handle in hQMgr, QMgr
      name in hQMgrName, and queue name in hQName */

   /* create a key seed string */
   rc = mqeString_newChar8(&exceptBlock, &hKeySeed,
            "my secret key");
   /* create a new attribute with a RC4 cryptor */
   rc = mqeMsgAttr_new(&exceptBlock, &hAttr, NULL,
            MQE_RC4_CRYPTOR_CLASS_NAME,
            NULL, hKeySeed);
   /* get message */
   rc = mqeQueueManager_getMessage(hQMgr, &exceptBlock,
            &hData, hQMgrName,
            hQName, NULL, hAttr, 0);
   /* get test data */
   rc = mqeString_newChar8(&exceptBlock, &hFieldName,
            "MsgData");
   rc = mqeFields_getAscii(hData, &exceptBlock,
            &hFieldData, hFieldName);

Terms of use | WebSphere software

(c) Copyright IBM Corporation 2004, 2005. All rights reserved.