In JBoss 4/5 our application required some special initialisation which we implemeted via a startup service using jboss-service.xml file:
<?xml version="1.0" encoding="UTF-8"?>
<server>
<mbean code="com.abc.jboss.StartupService" name="startup.abc.com:service=Startup">
<depends>jboss.j2ee:ear=ABCEJB.ear,jar=ABC.jar,name=AdministratorBean,service=EJB3</depends>
</mbean>
<mbean code="org.jboss.varia.scheduler.Scheduler" name="scheduler.abc.com:service=Scheduler">
<depends>jboss.j2ee:ear=ABCEJB.ear,jar=ABC.jar,name=AdministratorBean,service=EJB3</depends>
<attribute name="StartAtStartup">true</attribute>
<attribute name="SchedulableClass">com.abc.jboss.ScheduledService</attribute>
<attribute name="InitialStartDate">NOW</attribute>
<attribute name="SchedulePeriod">30000</attribute>
<attribute name="InitialRepetitions">-1</attribute>
</mbean>
<mbean code="com.ABC.backend.jmx.NotificationCenter"
name="NotificationCenter:name=notificationCenter">
<depends>jboss.j2ee:ear=ABCEJB.ear,jar=ABC.jar,name=AdministratorBean,service=EJB3</depends>
</mbean>
</server>
However for JBoss 7 I haven't been able to find a similar solution. Any pointers on how best to implement this in JBoss 7.2 ? Note that some services require specific ejbs to be available so it should only start this service once the application is deployed.
Use EE6 standard features for that.
create @Singleton @Startup ejb bean
and process your stuff in method annotated with @PostConstruct
--
tomaz