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

配置 JCA 激活规范
您可以配置符合 Java™ EE 连接器体系结构 (JCA) 规范的激活规范。
关于此任务
注: 要为 Liberty 概要文件配置 JCA 支持,必须使用WebSphere® Application Server Developer Tools for Eclipse 的服务器配置编辑器的“源”视图或某个其他文本编辑器来编辑 server.xml 文件。本主题假定在服务器中已配置具有唯一标识 MyAdapter 的资源适配器,请参阅有关配置资源适配器的文档以获取更多详细信息。以下步骤中提供了配置基本场景的端到端示例。
注: 不支持在 WebSphere® Development Tools (WDT) 的“设计”视图中编辑连接工厂、管理对象、激活规范和资源适配器的服务器配置的属性子元素。
过程
示例
使用以下示例来了解如何配置具有两种消息侦听器类型且接口类名唯一的资源适配器。
在 ra.xml 文件中的以下片段中,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 文件中的以下片段中,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 文件的以下片段中,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 配置元素的信息以了解如何覆盖配置元素名称的后缀。