aspose file tools*
The moose likes JBoss/WildFly and the fly likes how to force instantiation of MDBs when JBoss starts up? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » JBoss/WildFly
Bookmark "how to force instantiation of MDBs when JBoss starts up?" Watch "how to force instantiation of MDBs when JBoss starts up?" New topic
Author

how to force instantiation of MDBs when JBoss starts up?

Csk Kumar
Greenhorn

Joined: Mar 07, 2011
Posts: 13
Hi,
I am implementing an event handler using MDB and i am using jboss-5.1.0.GA. In my case, whenever jboss starts up my MDB (constructor should be called) should get instantiated , so that whenever message comes to the queue my onMessage() method will be invoked for message processing. In my MDB constructor i am doining instantiation of other required classes for message processing.

Issue:
But now the issue is my MDB constructor is getting called only after the message comes to the queue, becuase of this my message processing(onMessage call) is getting delayed.
Could you please tell me how to instantiate pool of MDB's when JBoss starts up?

Thanks in advance!!

My MDB code looks like this:
EventHandlerMDB.java



Queue configuration in Jboss looks like this:destinations-service.xml

Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5830
    
    7

There is no configuration option to do this, so the typical way is to create a startup service and have it feed some dummy messages to the queue. This might help you get started:
http://community.jboss.org/wiki/ExampleHelloWorldService


JBoss In Action
Csk Kumar
Greenhorn

Joined: Mar 07, 2011
Posts: 13
Hi,
Thanks for the reply. It was really hepfull.
As you said now I am sending dummy messages to the queue during jboss startup and it is working fine .
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to force instantiation of MDBs when JBoss starts up?