[jboss-user] [EJB 3.0] - deploy and use own timerservice

mwoelke do-not-reply at jboss.com
Thu Jun 19 08:33:24 EDT 2008


consider the following environment:

We have an app which is working on an oracle database. The application uses timers as well. By default they get serialized to the hsqldb. 
What we want is to switch them to the oracle datasource, which is easy configuring timers globally to use the oracle datasource. Unfortunately thats not what we would consider best. We want to make this configuration part of our deployment. Which means we want to deploy our own timerservice linked to the oracle datasource. The reason for this is we dont want to change the jboss configuration every time our environment changes. We want to handle this by configuring our packaging system, since this means we change it once instead of changing the configuration of each and every jboss running our app. 

Thats where the questions come in.

How can I configure this? And where do I put the appropriate deployment descriptors. My guess would be to deploy a sar with a jboss-service.xml which defines an instance of the jboss timerservice like this:

  <mbean code="org.jboss.ejb.txtimer.EJBTimerServiceImpl"
  |     name="jboss.ejb:applicational=EJBTimerService">
  |     <attribute name="RetryPolicy">jboss.ejb:service=EJBTimerService,retryPolicy=fixedDelay</attribute>
  |     <attribute name="PersistencePolicy">jboss.ejb:applicational=EJBTimerService,persistencePolicy=database</attribute>
  |     <attribute name="TimerIdGeneratorClassName">org.jboss.ejb.txtimer.BigIntegerTimerIdGenerator</attribute>
  |     <attribute name="TimedObjectInvokerClassName">org.jboss.ejb.txtimer.TimedObjectInvokerImpl</attribute>
  |     <depends optional-attribute-name="TransactionManagerFactory" proxy-type="org.jboss.tm.TransactionManagerFactory">
  |       jboss:service=TransactionManager
  |     </depends>
  |   </mbean>
  |   <mbean code="org.jboss.ejb.txtimer.DatabasePersistencePolicy" name="jboss.ejb:applicational=EJBTimerService,persistencePolicy=database">
  |     <!-- DataSourceBinding ObjectName -->
  |     <depends optional-attribute-name="DataSource">jboss.jca:service=DataSourceBinding,name=MyOracleDs</depends>
  |     <!-- The plugin that handles database persistence -->
  |     <attribute name="DatabasePersistencePlugin">org.jboss.ejb.txtimer.GeneralPurposeDatabasePersistencePlugin</attribute>
  |     <!-- The timers table name -->
  |     <attribute name="TimersTable">TIMERS</attribute>
  |   </mbean>
As I understand it this should create another instance of the timerservice with a different name. Any suggestions to this?

The next problem I have is that I dont know how to use it. When simply injecting the timerservice to a bean jboss seems to inject the default timerservice. Again my guess would be to specify something with the @Resource annotation, but I dont know how to do it. Although I would like it best to have the application server pick the correct timerservice on its own without further hinting by @Resource. 

Is there a way to have the container consider the applications deployment first? And if there is, how to use it?

Please tell me what you think about it. Is there a better solution to this?

Thanx in advance, 
Milan Woelke

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4159253#4159253

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4159253

More information about the jboss-user mailing list