使用JCA入站套接字资源进行MDB的部署后配置

时间:2011-12-20 18:57:11

标签: sockets glassfish ejb jca inbound

我有一个消息驱动的bean,它是通过GlassFish 3.1.1应用服务器中的JCA资源适配器从TCP套接字上接收的数据调用的。 sun-ejb-jar.xml文件中的部署描述符指定套接字的URL和端口。部署MDB时,我看到应用服务器在MessageEndpointFactory和ActivationSpec作为参数的资源适配器中执行endpointActivation()方法。

这在部署之前知道URL和端口并且可以在XML文件中指定时工作正常,但现在我需要能够在EJB代码中在运行时更改TCP套接字。我在JCA规范中找不到关于如何在运行时执行此操作的任何引用。

作为参考,我从Oracle网站下载了规范。 J2EE Connector Architecture Specification Version 1.5

基本上,我想将以下用于填充ActivationSpec的XML代码移动到我的EJB代码中。

<sun-ejb-jar>
  <enterprise-beans>
    <ejb>
      <ejb-name>MyInboundSocketMDB</ejb-name>
      <mdb-resource-adapter>
        <resource-adapter-mid>jca-sockets-rar</resource-adapter-mid>
        <activation-config>
          <activation-config-property>
            <activation-config-property-name>url</activation-config-property-name>
            <activation-config-property-value>localhost</activation-config-property-value>
          </activation-config-property>
          <activation-config-property>
            <activation-config-property-name>port</activation-config-property-name>
            <activation-config-property-value>5006</activation-config-property-value>
          </activation-config-property>
        </activation-config>
      </mdb-resource-adapter>
    </ejb>
  </enterprise-beans>
</sun-ejb-jar>

感谢您的任何建议。

1 个答案:

答案 0 :(得分:0)

您可以在glassfish网站管理员中更改activation-config-property-value。