MQeQMgrConfirmMsg

Description
This function is used to support the assured message delivery mechanism of WebSphere MQ Everyplace. This API call tells the queue manager to commit the previous MQeQMgrGetMsg or MQeQMgrPutMsg operation. The application must have supplied a ConfirmID with these previous calls. The input parameter hMsg must contain the unique identifier UID of the message object that is to be confirmed. The unique identifier of a message object is a 64 bit integer value and the string name of the origin queue manager.

This function confirms only a single MQeQMgrGetMsg or MQeQMgrPutMsg operation and not a set of them, therefore this API is not a unit-of-work function.

Syntax
#include <hmq.h> 
MQEVOID MQeQMgrConfirmMsg( MQEHSESS hSess, MQECHAR * pQMName, 
                           MQECHAR * pQName, MQEINT32 Option, 
                           MQEHFIELDS hMsg, MQEINT32 * pCompCode, 
                           MQEINT32 * pReason) 

Parameters

MQEHSESS hSess - input
This session handle, returned by MQeInitialize.

MQECHAR * pQMName - input
A null terminated string containing the name of the queue manager.

MQECHAR * pQName - input
A null terminated string containing the name of the queue.

MQEINT32 Option - input

MQE_QMGR_OPTION_CONFIRM_GETMSG
Confirms an earlier MQeQMgrGetMsg operation

MQE_QMGR_OPTION_CONFIRM_PUTMSG
Confirms an earlier MQeQMgrPutMsg operation.

If both options are set, then MQE_QMGR_OPTION_CONFIRM_GETMSG takes precedent.

MQEHFIELDS hMsg - input
An MQeFields object that contains the unique identifier of the message object to be confirmed. This could be the same messages object handle that was used earlier with the MQeQMgrGetMsg and MQeQMgrPutMsg function call with the MQE_QMGR_OPTION_CONFIRMID option set. The function extracts the unique identifier of the message object handle and uses it to confirm the message on the queue. All other fields in the hMsg are ignored.

The application has to call MQeFieldsFree() to free the message object handle.

MQEINT32 * pCompCode - output
MQECC_OK, MQECC_WARNING or MQECC_ERROR.

MQEINT32 * pReason - output
If the returned *pCompCode equals MQECC_ERROR, *pReason may have any of the following values:

MQE_EXCEPT_INVALID_HANDLE

MQE_EXCEPT_INVALID_ARGUMENT
hMsg does not contain the UID fields of a message object.

MQE_EXCEPT_QMGR_INVALID_QMGR_NAME

MQE_EXCEPT_QMGR_INVALID_Q_NAME

MQE_EXCEPT_QMGR_UNKNOWN_QMGR

MQE_EXCEPT_QMGR_Q_DOES_NOT_EXIST

MQE_EXCEPT_NOT_FOUND
No confirmID is associated with the UID supplied in the hMsg .

MQE_EXCEPT_NETWORK_ERROR_OPEN|READ|WRITE

Return Value

MQEVOID

Example
#include <hmq.h>
MQEHSESS   hSess;
MQCHAR *   qm = "myQM";
MQCHAR *   q  = "QQ";
MQEHFIELDS hFilter = MQEHANDLE_NULL;
MQEINT32   i, n, nMsgs;
MQEINT32   compcode;
MQEINT32   reason;
MQEGMO     gmo = MQEGMO_DEFAULT;
 
hSess = MQeInitialize("MyAppsName", &compcode, &reason);
 
/* Set up the GMO for confirm msg operation */
gmo.Options     |= MQE_QMGR_OPTION_CONFIRMID;
gmo.ConfirmId.hi = 0;
gmo.ConfirmId.lo = 0x55aa;
 
hMsg  = MQeQMgrGetMsg( hSess, qm, q, &gmo, hFilter, 
								&compcode, &reason);
 
/* Process the message */
 
/* Confirms the message */
MQeQMgrConfirmMsg( hSess, qm, q, 
							MQE_QMGR_OPTION_CONFIRM_GETMSG, hMsg, 
                  &compcode, &reason);
MQeTerminate(hSess, &compcode, &reason);

See Also


© IBM Corporation 2002. All Rights Reserved