NonStop JMS C++ API Programmer's Guide
Troubleshooting
NonStop Server for Java Message Service C++ API Programmer’s Guide—526459-002
8-2
Recovering within Consumer::receive()
Operations
break;
}
catch (NSJMS_Exception& sqle)
{
int sqlCode = sqle.getErrorCode();
if (sqle.getErrorCode() == DUPLICATE_ROW ) //-8102
{
ABORTTRANSACTION();
continue;
}
if (sqle.getErrorCode() == RECORD_LOCK ) //73
{
ABORTTRANSACTION();
DELAY(10); // wait .1 sec
continue;
}
else
{
throw sqle;
}
}
} //end for dupCount
Recovering within Consumer::receive() Operations
Consumer::receive() operations, will occasionally encounter SQL -8551 and
should be retried. Using the retry logic is shown in this code fragment:
const static int RETRYCNT=100;
for (int dupCount=0; dupCount<RETRYCNT; dupCount++)
{
try
{
// Starting Transaction, Sending the Message
BEGINTRANSACTION();
pMsg = pConsumer->receive(3000);
ENDTRANSACTION();
break;
}
catch (NSJMS_Exception& sqle)
{
int sqlCode = sqle.getErrorCode();
if (sqle.getErrorCode() == RECORD_LOCK ) //73
{
ABORTTRANSACTION();
DELAY(10); // wait .1 sec
continue;
}
else
{
throw sqle;
}
}
} //end for dupCount