/* default trigger transmission rule - always allow transmission */ public boolean triggerTransmission(int noOfMsgs, MQeFields msgFields ){ return true; }
The return code from this rule tells the queue manager whether or not to transmit any pending messages. A return code of true means "transmit", while a return code of false means "do not transmit at this time".
/* Decide to transmit based on number of pending messages */ public boolean triggerTransmission( int noOfMsgs, MQeFields msgFields ) { if(noOfMsgs > 10) { return true; /* then transmit */ } else { return false; /* else do not transmit */ } }
/* The following function is mapped to the fPtrTransmitQMgr function pointer */ /* in the user's initialization function output parameter structure. */ MQERETURN myRules_TransmitQMgr( MQeRulesTransmitQMgr_in_ * pInput, MQeRulesTransmitQMgr_out_ * pOutput) { MQeExceptBlock * pExceptBlock = (MQeExceptBlock*)(pOutput->pExceptBlock); SET_EXCEPT_BLOCK_TO_DEFAULT(pExceptBlock); /* allow transmission to be triggered only if the number of pending messages > 10 */ if(pInput->msgsPendingTransmission <= 10) { SET_EXCEPT_BLOCK(pExceptBlock, MQERETURN_RULES_DISALLOWED_BY_RULE, MQEREASON_NA); } }