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's max pool
size is 20 units.
It is also possible to override pools for specific beans. You can use either the JBoss-specif-
ic org.jboss.ejb3.annotation.Pool annotation or the jboss-ejb3.xml de-
ployment descriptor. For more information on overriding pools for the chosen beans, visit
https://docs.jboss.org/author/display/WFLY8/EJB3+subsystem+configuration+guide .
If no bean instances are available, the request will be blocked until an active MDB com-
pletes a method call or the transaction times out.
Cooking message-driven beans
We will now add a message-driven bean to our application from the previous chapter,
which will be used to intercept messages when a new ticket is booked. For the purpose of
our example, we will just trace whether the JMS message has been received; however,
you can also use it for more complex purposes such as notifying external systems.
Create a new Java class, say BookingQueueReceiver , and enter the package name as
com.packtpub.wflydevelopment.chapter6.jms .
Once done, let's add the MDB configuration via an annotation, as shown here:
package com.packtpub.wflydevelopment.chapter6.jms;
import javax.ejb.ActivationConfigProperty;
import javax.ejb.MessageDriven;
import javax.inject.Inject;
import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.MessageListener;
import java.util.logging.Logger;
@MessageDriven(name = "BookingQueueReceiver",
activationConfig = {
@ActivationConfigProperty(propertyName =
"destinationLookup",
propertyValue = "java:jboss/jms/queue/
ticketQueue"), [1]
Search WWH ::




Custom Search