メッセージ駆動型 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 など) が提供されます。


フィードバック