I have an MDB that i developed to consume messages from a queue and write the data to a database. It works fine as long as no errors are thrown in the onMessage method of the mdb. But if an exception is thrown the message is not consumed from the queue. Is there a way to programmatically consume the message even if an error occurs?
class MyMDB implements MessageListener{ .... public void onMessage(Message message) { TextMessage txtMsg = (TextMessage)message; try { Connection dbconn = ds.getConnection(); String[] data = txtMsg.getText().split(","); PreparedStatement stmt = dbconn.prepareStatement( "INSERT INTO CUSTOMER_TBL values(?,?,?)"); stmt.setInt(1,Integer.parseInt(data[0])); stmt.setString(2,data[1]); stmt.setString(3,data[2]); stmt.execute(); dbconn.close(); } catch (Exception e) { carmdb_logger.error("Error inserting to database",e); } ... } Thanks, Matt Phillips