Delete

This method deletes a message from a queue. It does not return the message to the application that called it. You must specify the UniqueID and you can delete only one message per operation.

The queue can belong to a local or synchronous remote MQe queue manager. Including a valid lockID in the message filter allows you to delete messages that have been locked by a previous operation, for example browse. If a message is not available, the application returns an error.

/* Example for deleting a message */
MQeFieldsHndl hMsg,hFilter;

/* create the new message */
rc = mqeFields_new(&exceptBlock, &hMsg);
if (MQERETURN_OK == rc) {

    /* add application fields here */
    /* ... */


    /* put message to a queue */
    rc = mqeQueueManager_putMessage(hQueueManager, 
                        &exceptBlock, 
                        hQMName,
                        hQueueName, hMsg, 
                        NULL,0);
    if (MQERETURN_OK == rc) {
        /* Delete requires a filter - 
        this can most easily be*/
      /*  found from the UID fields of the message*/
        rc = mqeFieldsHelper_getMsgUidFields(hMsg, 
                              &exceptBlock,
                              &hFilter);
    }

}


/* some time later want to delete the message  - 
    use the esatblished filter */
rc = mqeQueueManager_deleteMessage(hQueueManager,
                                 &exceptBlock,
                                  hQMName,
                                  hQueueName,
                                  hFilter);

Terms of use | WebSphere software

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