I have MDB that gets a message and creates a Timer in the onMessage() method. The MDB class also implements TimedObject too. Pretty much everything works as expected; ejbTimeout() fires upon time expiration of the Timer created in onMessage() invocation.
So now I want timer to persist (oh JBOSS 5.1.0ga -- using a slightly/insignificantly modified version of 'standard' profile) and then expire (calling ejbTimeout()) after a server restart or crash.
So I did nothing -- as it looks like by default persistence is 'on' for Timers. I made a new timer and shut down JBOSS (gracefully) before the timer expired. I restarted JBOSS (no deployment changes) -- ejbTimeout() never happended.
Ok so I updated ejb2-timer-service.xml to use a different data source that points to an Oracle DB. And now I could actually see the TIMERS table and I can see records come and go. Great!
So I retested my restart case - the timer record gets in DB -- jboss goes down -- I restart JBOSS -- no expiration. Hmm...I am not doing it correctly...
I fiddle around in JMX console and find the resetAndRestoreTimers() operation on the TimerService MBean. I invoke. The TIMER record goes away from DB and I get an error like:
13:41:23,338 WARN [DatabasePersistencePolicy] Unable to restore timer record: [id=1264615860179,target=[target=jboss.j2ee:jndiName=local/DillyDallyMDB@26175815,service=EJB],first=27-Jan-2010 13:12:34.261,periode=0]
I think this means something like the EJB that is suppose to get the Expiry notice (local/DillyDallyMDB@26175815 , perhaps??) can't be found. Which sorta make sence as when I restarted, although I didn't change anything -- that instance is gone (but there is a new one -- just not with that complete name??).
So can I work around this?
Do I have a fundamental mis-understanding of the TIMER service and persistence?
If it can be fixed, is there a way that resetAndRestoreTimers() can just happen on startup?
Should I not be use a combined MDB and TimedObject implementation?
I deployed my MDB as if it were a normal MDB I didnt' do anything magical in DD. Is something suppose to be in DD that says, 'this is the target of a timer'?
Any other guidance?