메시지 구동 Bean 배치 디스크립터 예제

이 코드 예제에서는 메시지 구동 Bean을 정의하는 데 사용되는 EJB 2.0 및 EJB 2.1 배치 디스크립터 요소들의 차이점에 대해 설명합니다.

EJB 2.0

이 코드 샘플은 배치 디스크립터의 EJB 2.0 메시지 구동 Bean 설명을 나타냅니다.

<message-driven id="Mdb20">
  	  <ejb-name>Mdb</ejb-name>
  	  <ejb-class>ejbs.MdbBean</ejb-class>
  	  <transaction-type>Bean</transaction-type>
  	  <message-selector>mdbMessage</message-selector>
  	  <acknowledge-mode>Auto-acknowledge</acknowledge-mode>
  	  <message-driven-destination>
    		<destination-type>javax.jms.Topic</destination-type>
    		<subscription-durability>Durable</subscription-durability>
  	   </message-driven-destination>
</message-driven>

EJB 2.1

이 코드 샘플은 배치 디스크립터의 EJB 2.1 메시지 구동 Bean 설명을 나타냅니다.

<message-driven id="Mdb21">
  <ejb-name>Foo</ejb-name>
  <ejb-class>ejbs.FooBean</ejb-class>
  <messaging-type>javax.jms.MessageListener</messaging-type>
  <transaction-type>Bean/transaction-type>
  <message-destination-type>javax.jms.Topic</message-destination-type>
  <activation-config>
    <activation-config-property>
      	   <activation-config-property-name>destinationType</activation-config-property-name>
      	   <activation-config-property-value>javax.jms.Topic</activation-config-property-value>
    	 </activation-config-property>
    <activation-config-property>
      	   <activation-config-property-name>subscriptionDurability</activation-config-property-name>
      	     <activation-config-property-value>Durable</activation-config-property-value>
    	 </activation-config-property>
    <activation-config-property>
      	     <activation-config-property-name>acknowledgeMode</activation-config-property-name>
      	     <activation-config-property-value>AutoAcknowledge</activation-config-property-value>
    	 </activation-config-property>
    <activation-config-property>
      		<activation-config-property-name>messageSelector</activation-config-property-name>
      		<activation-config-property-value>fooSelector</activation-config-property-value>
    	 </activation-config-property>
  </activation-config>
  </transaction-type>
</ejb-name>
</message-driven>

EJB 2.1에서 스펙은 수신확인 모드, 메시지 선택기, 구독 지속성 및 대상 유형과 같은 특성을 정의하는 데 사용할 <activation-config-property> 요소를 정의합니다. 비JMS 메시지 전달 유형을 사용하는 경우 마법사의 안내에 따라 Bean에 사용해야 하는 <activation-config-property> 이름 및 값 쌍을 정의할 수 있습니다. JMS 메시지 전달 시스템의 경우 마법사는 JMS에 필요한 기본 구성 특성(예: subscriptionDurabilityacknowledgeMode)을 제공합니다.


피드백