Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to force instantiation of MDBs when JBoss starts up?

 
Csk Kumar
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 5852
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Csk Kumar
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 .
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic