配置 JCA 啟動規格

您可以配置遵守 Java EE 連接器架構 (JCA) 規格的啟動規格。

關於這項作業

您可以配置一或多個由所安裝之資源配接器提供的啟動規格實例。
註: 如果要配置 Liberty 的 JCA 支援,您必須使用 WebSphere® Application Server Developer Tools for Eclipse 的伺服器配置編輯器的「程式碼」視圖,或是其他文字編輯器,來編輯 server.xml 檔。此主題假設已在伺服器中配置唯一 ID 為 MyAdapter 的資源配接器,請參閱有關配置資源配接器的說明文件,以取得進一步的詳細資料。下列步驟中有提供配置基本實務範例的端對端範例。
註: 不支援在 WebSphere® Development Tools (WDT) 的「設計」視圖中,針對 Connection Factory、管理物件、啟動規格和資源配接器,編輯伺服器配置的內容子元素。

程序

  1. 更新 server.xml 檔案,在 featureManager 標籤底下新增 jca-1.6 特性。
    <featureManager>
    	<feature>jca-1.6</feature> 
    	<feature>jndi-1.0</feature>  <!-- Add the jndi feature to enable look up of connection factories and administered objects. -->   
    		... 
    </featureManager>
  2. 安裝資源配接器。 例如,更新 server.xml 檔案,如下所示:
    <resourceAdapter location="C:/adapters/MyAdapter.rar"/>
  3. 配置一或多個啟動規格。 當您配置啟動規格時,即使不想置換任何配置內容,也必須提供 properties 子元素,以將 activationSpec 元素與特定資源配接器提供的訊息接聽器類型建立關聯。在下列範例中,MyAdapter 資源配接器只提供一種訊息接聽器類型:
    <activationSpec id="app1/module1/MyMessageDrivenBean">
     <properties.MyAdapter messageFilter="ALL"/>
    </activationSpec>
  4. 若有需要,請識別可用的啟動規格內容子元素名稱。
    • 如果資源配接器提供正好一個訊息接聽器介面(不包括任何 JMS Connection Factory),則子元素名稱為:properties.<rar_identifier>

    • 如果訊息接聽器介面名稱是唯一的,且沒有套件名稱,則子元素名稱是:properties.<rar_identifier>.<MessageListenerInterfaceName>

    • 如果啟動規格實作名稱是唯一的,且沒有套件名稱,則子元素名稱是:properties.<rar_identifier>.<ActivationSpecificationImplementationName>

    • 如果啟動規格實作名稱是唯一的,且沒有套件名稱,則子元素名稱是:properties.<rar_identifier>.<ActivationSpecificationImplementationName>

    • 在其他情況下,子元素名稱為:properties.<rar_identifier>.<fully.qualified.MessageListenterInterfaceName>

  5. 請參閱部署訊息驅動 Bean 說明文件,取得如何使啟動規格與訊息驅動 Bean 產生關聯的相關資訊。

範例

使用下列範例來了解,如何以具有唯一介面類別名稱的兩種訊息接聽器類型,來配置資源配接器。

ra.xml 檔案的下列 Snippet 中,MyAdapter 資源配接器提供具有唯一介面類別名稱的兩種訊息接聽器類型:

<messagelistener>
<messagelistener-type>javax.resource.cci.MessageListener</messagelistener-type>
<activationspec> 
 <activationspec-class>com.vendor.adapter.CCIActivationSpec</activationspec-class>
 <config-property>
  <config-property-name>maxSize</config-property-name>
  <config-property-type>java.lang.Long</config-property-type>
 </config-property>
 ...
</activationspec>
...
</messagelistener>

<messagelistener>
<messagelistener-type>com.vendor.adapter.MyMessageListener</messagelistener-type>
<activationspec> 
 <activationspec-class>com.vendor.adapter.MyActivationSpec</activationspec-class>
 <config-property>
  <config-property-name>messageFilter</config-property-name>
  <config-property-type>java.lang.String</config-property-type>
 </config-property>
 ...
</activationspec>
...
</messagelistener>
以下是適用於此實務的伺服器配置範例:
<activationSpec id="app1/module1/CCIMessageDrivenBean">
 <properties.MyAdapter.MessageListener maxSize="1024"/>
</activationSpec> 

<activationSpec id="app1/module1/MyMessageDrivenBean">
 <properties.MyAdapter.MyMessageListener messageFilter="ALL"/>
</activationSpec>

使用下列範例來了解,如何以具有唯一實作類別名稱的兩種訊息接聽器類型,來配置資源配接器。

ra.xml 檔案的下列 Snippet 中,MyAdapter 資源配接器提供具有唯一實作類別名稱的兩種訊息接聽器類型:

<messagelistener>
<messagelistener-type>javax.resource.cci.MessageListener</messagelistener-type>
<activationspec> 
 <activationspec-class>com.vendor.adapter.CCIActivationSpec</activationspec-class>
 <config-property>
  <config-property-name>maxSize</config-property-name>
  <config-property-type>java.lang.Long</config-property-type>
 </config-property>
...
</activationspec>
...
</messagelistener>

<messagelistener>
<messagelistener-type>com.vendor.adapter.MessageListener</messagelistener-type> 
<activationspec> 
 <activationspec-class>com.vendor.adapter.MyActivationSpec</activationspec-class>
 <config-property>
  <config-property-name>messageFilter</config-property-name>
  <config-property-type>java.lang.String</config-property-type>
 </config-property>
...
</activationspec>
...
</messagelistener>
以下是適用於此實務的伺服器配置範例:
<activationSpec id="app1/module1/CCIMessageDrivenBean">
 <properties.MyAdapter.CCIActivationSpec maxSize="1024"/>
</activationSpec> 

<activationSpec id="app1/module1/MyMessageDrivenBean">
 <properties.MyAdapter.MyActivationSpec messageFilter="ALL"/>
</activationSpec>

使用下列範例來了解,如何以簡式介面和實作類別名稱都不是唯一的兩種訊息接聽器類型,來配置資源配接器。

ra.xml 檔案的下列 Snippet 中,MyAdapter 資源配接器提供兩種訊息接聽器類型,其中簡式介面和實作類別名稱都不是唯一的:

<messagelistener>
<messagelistener-type>javax.resource.cci.MessageListener</messagelistener-type>
<activationspec> 
 <activationspec-class>com.vendor.adapter.cci.ActivationSpec</activationspec-class>
 <config-property>
  <config-property-name>maxSize</config-property-name>
  <config-property-type>java.lang.Long</config-property-type>
 </config-property>
...
</activationspec>
...
</messagelistener>

<messagelistener>
<messagelistener-type>com.vendor.adapter.MessageListener</messagelistener-type> 
<activationspec> 
 <activationspec-class>com.vendor.adapter.ActivationSpec</activationspec-class>
 <config-property>
  <config-property-name>messageFilter</config-property-name>
  <config-property-type>java.lang.String</config-property-type>
 </config-property>
...
</activationspec>
...
</messagelistener>
以下是適用於此實務的伺服器配置範例:
<activationSpec id="app1/module1/CCIMessageDrivenBean">
 <properties.MyAdapter.javax.resource.cci.MessageListener maxSize="1024"/>
</activationSpec> 

<activationSpec id="app1/module1/MyMessageDrivenBean">
 <properties.MyAdapter.com.vendor.adapter.MessageListener messageFilter="ALL"/>
</activationSpec>

您可以置換配置元素名稱的字尾。請參閱自訂 JCA 配置元素的相關資訊,以了解如何置換配置元素名稱的字尾。


指示主題類型的圖示 作業主題



「時間戳記」圖示 前次更新: 2016 年 11 月 30 日
http://www14.software.ibm.com/webapp/wsbroker/redirect?version=cord&product=was-libcore-mp&topic=twlp_jca_config_actspec
檔名:twlp_jca_config_actspec.html