EJB 3.0에서 메시지 대상 유형, 이름 등을 @ActivationConfigProperty
으로 구성했지만 EJB 2.0에서와 같이 배포 설명자 (ejb-jar.xml
)를 사용하여 MDB
을 구성하려고했습니다. 참고로EJB 3.0의 MessageDrivenBean (MDB)에 대한 주석 대신 ejb-jar.xml을 사용할 수 있습니까?
: 나는 보스 6
사용하고 는는 그 누구도 날이에 안내 할 수 있습니까?
EJB 3.0에서 메시지 대상 유형, 이름 등을 @ActivationConfigProperty
으로 구성했지만 EJB 2.0에서와 같이 배포 설명자 (ejb-jar.xml
)를 사용하여 MDB
을 구성하려고했습니다. 참고로EJB 3.0의 MessageDrivenBean (MDB)에 대한 주석 대신 ejb-jar.xml을 사용할 수 있습니까?
: 나는 보스 6
사용하고 는는 그 누구도 날이에 안내 할 수 있습니까?
고맙습니다.하지만 나는 훨씬 간단한 방법으로 알아 냈습니다. 아래 코드는
<ejb-jar id="ejb-jar_ID" version="3.1"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/ejb-jar_3_1.xsd">
<display-name>SampleTransactionMDB</display-name>
<enterprise-beans>
<message-driven>
<display-name>SampleTransactionMDB</display-name>
<ejb-name>SampleTransactionMDB</ejb-name>
<ejb-class>com.example.SampleTransactionMDB</ejb-class>
<transaction-type>Container</transaction-type>
<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>/queue/SampleTransactionQueue</activation-config-property-value>
</activation-config-property>
</activation-config>
</message-driven>
</enterprise-beans>
<assembly-descriptor>
</assembly-descriptor>
</ejb-jar>
다음은 MDB 구성을위한 xml 콘텐츠이며, 이에 따라 아래 코드를 수정할 수 있습니다.
<enterprise-beans>
<message-driven>
<ejb-name>SomeMessageBean</ejb-name>
<ejb-class>
com.bean.SomeMessageBean
</ejb-class>
<messaging-type>javax.jms.MessageListener</messaging-type>
<transaction-type>Container</transaction-type>
<message-destination-type>
javax.jms.Queue
</message-destination-type>
<activation-config>
<activation-property>
<activation-config-property-name>destinationType
</activation-config-property-name>
<activation-config-property-value>javax.jms.Queue
</activation-config-property-value>
</activation-property>
<activation-property>
<activation-config-property-name>messageSelector
</activation-config-property-name>
<activation-config-property-value>MessageFormat = 'Version 3.4'
</activation-config-property-value>
</activation-property>
<activation-property>
<activation-config-property-name>acknowledgeMode
</activation-config-property-name>
<activation-config-property-value>Auto-acknowledge
</activation-config-property-value>
</activation-property>
</activation-config>
<resource-ref>
<resource-ref-name>jms/ConnectionFactory</resource-ref-name>
<resource-type>
javax.jms.ConnectionFactory
</resource-type>
<res-auth>Container</res-auth>
<mapped-name>ConnectionFactory</mapped-name>
<injection-target>
<injection-target-class>
com.bean.SomeMessageBean
</injection-target-class>
<injection-target-name>datasource</injection-target-name>
</injection-target>
</resource-ref>
</message-driven>
</enterprise-beans>