Java Reference
In-Depth Information
The bean pool's configuration is contained in the bean pool central tab, which holds
both the stateless and MDB pool configurations. The default value for the MDB Max
Pool Size is 20 units.
If no bean instances are available, the request will be blocked until an active MDB
completes a method call or the transaction times out.
Cooking message-driven beans
We will now add a message-driven bean to our application, which will be used to
intercept messages when a new Ticket has been booked. For the purpose of our
example, we will just trace that the JMS message has been received; however, you
can use it for more complex purposes such as notifying external systems.
So, in the Eclipse menu simply navigate to New | Other | EJB | EJB 3 Message
Driven Bean . Create a new Java class MDBService and enter the package name
as com.packtpub.as7development.chapter7.service . This will create a
bare-bones MDB with just an empty OnMessage method.
Once done, let's add the MDB configuration via annotation as shown here:
package
com.packtpub.as7development.chapter7.service;
import java.util.logging.Logger;
import javax.ejb.*;
import javax.inject.Inject;
import javax.jms.*;
@MessageDriven(name = "MDBService",
activationConfig = {
@ActivationConfigProperty(propertyName =
"destinationType", propertyValue =
"javax.jms.Queue"),
@ActivationConfigProperty(propertyName =
"destination", propertyValue = "java:jboss/jms/
Search WWH ::




Custom Search