There's the deployment.xml - you can have your ESB archive depend on an outside deployment. Maybe have an mbean do the initialization that you are looking for and then list it in the deployment.xml?
Or have a subclass for your actions that implements the initialize method?
Thanks for responding. Not quite what I was looking for though ...
I have a single ESB that presents multiple services and each of those services may have multiple actions. On deployment/startup, I'd like to have the services/actions 'wait' until one particular service/action has completed its initialization. Once that initialization is complete then the others would be free to continue with their own startup process.
Is there any way to do this? Is it possible to impose an ordering or sequence to the initialization process?
There's probably not going to be an exactly perfect option here, but there's plenty of options you can choose from. You could separate the one particular service from your .ESB archive, and depend upon the deployment of that archive in your deployment.xml. You could look at the service pipeline interceptors which were added in ESB 4.11 - if you set it up for service instantiation, it will run at every service instantiation. You would have to have some guard around whatever code you wanted to run there to make sure it only executes one time.
I was able to move my controlling service to its own ESB and then have my second ESB depend on the first using the deployment.xml.
Seems to work fine. Thanks!
Maybe spoke too soon here ...
Tom - can you shed some light on a behavior issue?
I have ESB-A and ESB-B. ESB-B has a dependancy on ESB-A. ESB-A, on initialization, runs a chunk of setup code that may take some amount of time to complete.
Here is the initialization sequence that I am seeing ...
1) ESB-A initializes and runs the setup code and successfully completes.
A few seconds later ...
2) JBoss undeploys ESB-A. ???
3) ESB-B then starts to initialize (Queues created, etc...)
4) ESB-A is then (re)deployed and initialization code runs again. ???
5) Once ESB-A finishes its initialization (again) then ESB-B runs its initialization code and completes successfully.
So... Why is ESB-A undeployed and then redeployed when ESB-B deployment starts?
What happens in the initialization code? Are you touching any files within the deployment?
At the moment, nothing much happens in the init code. This is in the beginning stages of development and I'm dealing with it as a POC for now. The intent of ESB-A will be to maintain a database. Currently, It only instantiates its DataSource via JNDI. ESB-B is only stubbed right now and only writes to the log.
Can you post the log that shows the init sequence? I'm confused by why ESB-A would undeploy, unless the initialization code is changing something within ESB-A and forcing a hot deployment.
Sorry for the response delay... I was pulled onto another project for awhile.
I think I may better understand what is happening here.
My ESBs are sharing a common connection factory definition. Each of the ESBs also have a dependancy on the CF declared in their deployment.xml.
When one ESB redeploys, the CF is unbound. This causes all of the other ESBs to shutdown due to the missing CF dependancy. As the first ESB initializes the CF is bound again and the remaining ESBs also startup and reinitialize.
So... Is there a way for ESBs to share a common CF but not incur this initialization ping-pong effect? Is there a way to allow an ESB to shutdown/restart without having the CF unbound (since other ESBs are using it)?