1 Reply Latest reply on Sep 1, 2004 3:12 AM by Parthasarathy Iyengar

    Message (and reference) removal

    Drew McAuliffe Newbie

      I've been trying to get JDBC persistence to work for topics, and was able to get both the jdbc2 and jdbc3 pms working with mysql. The only thing is, I'm not sure if I have things configured correctly because I don't see messages or references getting deleted. My understanding was that the message table would only keep a message around until every subscriber had received it. It looks like the messages are kept in the table forever, with no way to remove them without automating some kind of script. Without removing those messages, you could easily end up with a huge table filled with messages (the system I'm working on fires a message for most common system events and can easily produce a lot of object messages).

      Is the design of the pms to keep the messages around? if so, what is the justification? If not, what could I be doing wrong?

      PS as a peace offering, I've got two things:
      1) I have a working example for the sql attributes for mysql using the jdbc3 pm. I wasn't able to find one anywhere, so I updated the default jdbc3 config myself and made the necessary adaptations for mysql. I can post it if anyone is interested.
      2) I found a bug in the jdbc3 pm that will consistently cause a npe to be thrown on system startup. In the "removeMarkedReferences" method, there is the following line:

      stmt.setLong(1, txid.longValue());

      Unfortunately, the "resolveAllUncommittedTxs" method, which appears to be called on startup, has the following:
       // Delete all the non persistent references that were added by the
       // CacheStore interface of this PM
       removeMarkedReferences(c, null, "T");

      This pretty much guarantees an npe every time, b/c there's no null check on the txid param. This is what I did locally to fix it:
       if (txid == null)
       stmt.setNull(1, Types.INTEGER);
       stmt.setLong(1, txid.longValue());