3 Replies Latest reply on Sep 17, 2006 3:59 AM by Jay Glass

    Deleting Message Bodies

    sappenin Novice

      All,

      When/how do Message bodies get deleted? I don't see a delete Messagebody function in the MailboxService class, nor in the MailBody Manager.

      Does this happen automagically when the last MessageData to reference a given set of MessageBodies gets deleted?

      Thanks!

      David

        • 1. Re: Deleting Message Bodies
          Jay Glass Novice

          Theres a thread in here, from I and Andrew, with the same query, one moment...

          here it is, and if you look, you might find another, not sure

          http://www.jboss.com/index.html?module=bb&op=viewtopic&t=81585

          • 2. Re: Deleting Message Bodies
            sappenin Novice

            Hey,

            Thanks for the thread pointer. After poking around in the MailboxService class, there appears to be some logic that determines if a given messageBody is orphaned or not. This only gets called from the expunge() function, which appears to deal with expunging a folder, mostly from the IMAP code.

            However, I don't see anything like this happening in the UserApi (org.jboss.mail.userapi.MailSender) when a message gets deleted. The MessageData gets deleted, but not the Messagebody (directly at least).

            Is there some kind of automatic expunge happenin at a scheduled time, or on some other call? Otherwise it seems like the webmail would be creating orphaned message bodies.

            Thanks!

            David

            • 3. Re: Deleting Message Bodies
              Jay Glass Novice

              I think, at least with 1.4, it creates orphaned bodies, thas why Andrew recommended, you right a cron Job, or something similar, to expunge the bodies...

              if your looking for something, to handle it for you within JBoss, you might look, or search for jboss scheduler, as it seemed it would do nicely for say running a class that just called a sql procedure which deleted orpaned emails...

              good luck!

              jay

              PS: someone needs to write a patch...but I my self, suck at hibernate, I looked at it once, and have shied away since! Should learn it though!