Posted By:
Tom_Jenkinson
Posted On:
Thursday, November 7, 2002 02:33 AM
If I understand your problem correctly, you sound as if your on the right line with using CLIENT_ACKNOWLEDGE mode.
Basically what you can do is create the LOADER QueueReceiver with a session that is using CLIENT_ACKNOWLEDGE mode.
Sessions created in this mode can make use of the recover method of a session that will place unacknowledged messages back into the queue.
Check out this link for more info on recover:
http://java.sun.com/j2ee/sdk_1.3/techdocs/api/javax/jms/Session.html#recover()
See the following for a brief example:
{
// Receive the message
Message message = queueReceiver.receive();
try
{
// Try to handle the load to the database
databaseHandler.loadMessage(message);
// Acknowledge the message if succesful
message.acknowledge();
}
catch (Exception e)
{
// If you cannot load the message then invoked
// recover on the receivers session
queueReceiversSession.recover();
}
}
Hope this helps you,
Tom Jenkinson
Arjuna Technologies Limited