Развернуть MDB с помощью GenericJMSRA на GlassFish с аннотациями?

На GlassFish Server 2.1 я создал GenericJMSRA для соединения с ActiveMQ, как описано в этом руководстве: http://activemq.apache.org/sjsas-with-genericjmsra.html

Мне удалось успешно развернуть MDB, используя классический способ внедрения контекста с помощью ejb-jar.xml:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE ejb-jar PUBLIC '-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN'     'http://java.sun.com/dtd/ejb-jar
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sun-ejb-jar PUBLIC '-//Sun Microsystems, Inc.//DTD Application Server 8.1 EJB 2.1//EN' 'http://www.sun.com/software/appserver/dtds/sun-ejb-jar_2_1-1.dtd'>
<sun-ejb-jar>
  <enterprise-beans>
    <ejb>
      <ejb-name>QueueListener</ejb-name>
        <mdb-connection-factory>
          <jndi-name>jms/amqQueueConnectionFactory</jndi-name>
        </mdb-connection-factory>
        <mdb-resource-adapter>
        <resource-adapter-mid>activemqra</resource-adapter-mid>
        <activation-config>
          <activation-config-property>
            <activation-config-property-name>DestinationType</activation-config-property-name>
            <activation-config-property-value>javax.jms.Queue</activation-config-property-value>
          </activation-config-property>
          <activation-config-property>
          <activation-config-property-name>destination</activation-config-property-name>
            <activation-config-property-value>qRequest</activation-config-property-value>
          </activation-config-property>
        </activation-config>
      </mdb-resource-adapter>
    </ejb>
  </enterprise-beans>
</sun-ejb-jar>
0.dtd'> <ejb-jar> <enterprise-beans> <message-driven> <ejb-name>QueueListener</ejb-name> <ejb-class>foo.QueueListenerMDB</ejb-class> <transaction-type>Container</transaction-type> </message-driven> </enterprise-beans> </ejb-jar>

и солнце-ejb-jar.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sun-ejb-jar PUBLIC '-//Sun Microsystems, Inc.//DTD Application Server 8.1 EJB 2.1//EN' 'http://www.sun.com/software/appserver/dtds/sun-ejb-jar_2_1-1.dtd'>
<sun-ejb-jar>
  <enterprise-beans>
    <ejb>
      <ejb-name>QueueListener</ejb-name>
        <mdb-connection-factory>
          <jndi-name>jms/amqQueueConnectionFactory</jndi-name>
        </mdb-connection-factory>
        <mdb-resource-adapter>
        <resource-adapter-mid>activemqra</resource-adapter-mid>
        <activation-config>
          <activation-config-property>
            <activation-config-property-name>DestinationType</activation-config-property-name>
            <activation-config-property-value>javax.jms.Queue</activation-config-property-value>
          </activation-config-property>
          <activation-config-property>
          <activation-config-property-name>destination</activation-config-property-name>
            <activation-config-property-value>qRequest</activation-config-property-value>
          </activation-config-property>
        </activation-config>
      </mdb-resource-adapter>
    </ejb>
  </enterprise-beans>
</sun-ejb-jar>

Как мне продолжить внедрение приведенной выше конфигурации в стиле EJB 3.0, управляемом аннотациями? В частности, это следующее свойство, которое я не могу понять, как ввести:

<resource-adapter-mid>activemqra</resource-adapter-mid>

person aksamit    schedule 17.04.2013    source источник


Ответы (1)


Наконец-то заработало.

Я полностью удалил файл ejb-jar.xml и оставил файл sun-ejb-jar.xml нетронутым. Затем я аннотировал класс foo.QueueListenerMDB следующим образом:

@MessageDriven(name = "QueueListener", mappedName = "QueueListener")
public class QueueListenerMDB implements MessageListener {
    ...
}
person aksamit    schedule 18.04.2013