![[8.5.5.2 或更新版本]](../ng_v8552.gif)

配置 JCA 啟動規格
您可以配置遵守 Java™ EE 連接器架構 (JCA) 規格的啟動規格。
關於這項作業
註: 如果要配置 Liberty 設定檔的 JCA 支援,您必須使用 WebSphere® Application Server Developer Tools for Eclipse 的「伺服器配置」編輯器的「程式碼」視圖,或其他文字編輯器,來編輯 server.xml 檔。此主題假設已在伺服器中配置唯一 ID 為 MyAdapter 的資源配接器,請參閱有關配置資源配接器的說明文件,以取得進一步的詳細資料。下列步驟中有提供配置基本實務範例的端對端範例。
註: 不支援在 WebSphere® Development Tools (WDT) 的「設計」視圖中,針對 Connection Factory、管理物件、啟動規格和資源配接器,編輯伺服器配置的內容子元素。
程序
範例
使用下列範例來了解,如何以具有唯一介面類別名稱的兩種訊息接聽器類型,來配置資源配接器。
在 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 配置元素的相關資訊,以了解如何置換配置元素名稱的字尾。