Example - C

This example is taken from the examples.application.example6 example application:

MQEINT32 maxRetry = 5;

rc = mqeQueueManager_putMessage(hQMgr, 
                    &exceptBlock, 
                    hQMgrName, 
                    hQName, hMsg, 
                    NULL, confirmId);

/* if the put attempt fails, 
    retry up to the maximum number*/
/*of retry times permitted, 
    setting the re-send flag. */
while (MQERETURN_OK != rc 
          && --maxRetry > 0 ) {
    rc = mqeFields_putBoolean(hMsg, &exceptBlock, 
                      MQE_MSG_RESEND, MQE_TRUE);
    if(MQERETURN_OK == rc) {
       rc = mqeQueueManager_putMessage(hQMgr, &exceptBlock, 
                            hQMgrName, hQName, 
                            hMsg, NULL, confirmId);
    }
}

if(MQERETURN_OK == rc) {
    MQeFieldsHndl hFilter;
    maxRetry = 5;
    rc = mqeFieldsHelper_getMsgUidFields(hMsg, 
                        &exceptBlock, 
                        &hFilter);
    if(MQERETURN_OK == rc) {
          rc = mqeQueueManager_confirmPutMessage(hQMgr, 
                          &exceptBlock, 
                          hQMgrName, hQName, 
                          hFilter);
    }
     while (MQERETURN_OK != rc 
                && --maxRetry > 0 ) {
             rc = mqeQueueManager_confirmPutMessage(hQMgr, 
                                    &exceptBlock, 
                                      hQMgrName, 
                                      hQName, 
                                      hFilter);
    }
}

Terms of use | WebSphere software

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