Home JBoss Server JBoss AS Service Dependency: an use case
12 | 03 | 2010
JBoss 5 AS Book
"JBoss AS 5 development" reviews
Please share your feedback/review with other readers!
Banner
Dashboard
Advertise with Us
Banner
RSS Feed
Login
Sign here for the NewsLetter.



Poll
What book could be in your wish list next XMas ?
 
JBoss admin resources
Banner
JBoss howto

How can you solve deployment errors caused by large war/jar/ear files ?

jboss recipe of the day ...
Read More

How do you configure your .war to be deployed after your EJB ?

jboss recipe of the day ...
Read More

How do I configure a Queue/Topic to work in a cluster?

JBoss recipe of the day ...
Read More
JBoss AS Service Dependency: an use case PDF Print E-mail
Written by F.Marchioni   
Thursday, 10 December 2009 10:22

JBoss AS has plenty of services available ready for use. However sometimes you might have the need to start a certain service after that your deployments units are available. Let's see how we can choose to deploy a service after your applications.

A typical use case would be that the EJB Timer service, which is configured in the server deploy directory with the ejb3-timer-service.xml.

(A tutorial about the EJB3 Timer service is available here: http://www.mastertheboss.com/en/jboss-server/225-ejb-timer-service.html)

Supposing you want your Timer service to be started after that your applications (a Web application and an EJB application) are deployed as shown here:

jboss as service mbean depends

All you have to do is adding a <depends> attribute to the EJB3TimerService MBean. Open the ejb3-timer-service.xml. This file already contains some dependancies on other services, we will add here our deployment dependency:
<server>
	 	
 
	<mbean code="org.jboss.ejb3.timerservice.quartz.jmx.EJB3TimerService" name="jboss.ejb:service=EJB3TimerService">
		<depends>jboss:service=Naming</depends>
		<depends>jboss:service=TransactionManager</depends>
		<depends optional-attribute-name="DataSource">jboss.jca:service=DataSourceBinding,name=DefaultDS</depends>
		
	<!-- WEB dependency -->
	<depends>jboss.web.deployment:war=/WebApplication</depends>
	<!-- EJB dependency -->
		<depends>jboss.j2ee:jar=EJBApplication.jar,name=TestEJBBean,service=EJB3</depends>
		
		<attribute name="Properties">
                 <!-- commented for brevity -->
		</attribute>
	</mbean>
</server>
As you can see, adding a dependency for a Web application is quite easy, you have just to add the WebContext name of the application. Dependency of an EJB application is also easy, you have just to state some additional information like the EJB Class name and the Service type (EJB3) as it falls in the generic jboss.j2ee tree. 

JBoss.org Search
Custom Search
Comments
Search
Only registered users can write comments!

3.26 Copyright (C) 2008 Compojoom.com / Copyright (C) 2007 Alain Georgette / Copyright (C) 2006 Frantisek Hliva. All rights reserved."

Last Updated ( Thursday, 10 December 2009 10:42 )