ConfiguringEJB3MDBs

Version 11

    Configuring Message Driven Beans(MDBs) using EJB3

     

     

    Description: This article explains how to configure MDBs for use with EJB3.  It explains several annotations that can be used when configuring mdbs and also explains how to set the defaults for all mdbs or segments of mdbs.  This topic will also discuss the major tuning points for mdbs using ejb3, including how to set the number of threads serving mdbs, the number of instances of mdb, and other tuning points.  

     

    Note:This article is not specific to any messaging provider(JBoss Messaging or Jboss MQ).  The settings described here will work for both.

     

    Note:Please note that the configuration files for configuring EJB 2.1 ejbs are completely different.  EJB3 is a completely separate product with completely different configuration files.

     

     

    MDB Configuration with annotations

    Just to set the stage, with EJB3, you no longer need to set configuration in your xml.  You can annotate your mdbs and deploy them.  Here is an example of an MDB configuration taken from the example, Using JMS and MDB to Log to a Database

     

    @MessageDriven(activateConfig =
    {
      @ActivationConfigProperty(propertyName="destinationType",
        propertyValue="javax.jms.Queue"),
      @ActivationConfigProperty(propertyName="destination",
        propertyValue="queue/myCustomLog")
    })
    public class LoggingService implements MessageListener