我正在将应用程序从 Websphere Application Server 7 迁移到 8.5。该应用程序使用具有 JMS 激活规范的 MessageDrivenBean 来使用队列中的消息。在之前的版本中,我们使用 ibm-ejb-jar-bnd.xml 来绑定(bind)激活规范:
<ejb-jar-bnd xmlns="http://websphere.ibm.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://websphere.ibm.com/xml/ns/javaee http://websphere.ibm.com/xml/ns/javaee/ibm-ejb-jar-bnd_1_0.xsd"
version="1.0">
<message-driven name="SampleMDB">
<jca-adapter activation-spec-binding-name="jms/as/sample" activation-spec-auth-alias="" />
</message-driven>
</ejb-jar-bnd>
是否有与上述内容等效的注释可在 MessageDrivenBean 中使用?
@MessageDriven
@TransactionManagement(TransactionManagementType.BEAN)
public class SampleMDB implements MessageListener {
...
}
最佳答案
不可以,MDB 必须使用绑定(bind)文件进行绑定(bind),或者在安装过程中通过控制台或脚本手动进行绑定(bind)。目前无法通过注释绑定(bind)它,但您可以安全地使用版本 8.5 的相同绑定(bind)文件。
关于jms - 与激活规范绑定(bind)名称等效的注释,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24507088/