WebSphere AS 7 中 MDB 的 ActivationConfig 和 ActivationSpec
我目前正在使用 WebSphere-MQSeries 为 WebSphere AS 7 开发一个小型 EJB 3 应用程序。这是一个非常简单的应用程序,主要由一个 MDB 监听队列、转换传入消息并将提取的数据写入数据库组成。我终于启动并运行了它,但我对代码中的 ActivationConfig 注释、ibm-ejb-jar-bnd.xml 和 WAS 本身的激活规范有点困惑。我的主要问题是,为什么我需要所有这些?当我仍然需要在 WAS 中指定目标(例如队列名称)的激活规范时,为什么我应该/可以通过注释(@ActivationConfigProperty)指定队列名称或目标类型等内容?另外我还需要通过 xml 文件进行绑定吗?是这样吗?是否也可以通过注释指定激活规范名称,从而摆脱 xml 绑定文件?我可以避免在 WAS 中创建激活规范吗?
希望有人能澄清一下,谢谢。
I'm currently developing a small EJB 3 application for WebSphere AS 7 with WebSphere-MQSeries. It's a very simple app that mainly consists of one MDB listening on a queue, convert the incoming messages and write the extracted data into a db. I've finally got up it and running, but I'm a bit confused regarding ActivationConfig annotations in the code, the ibm-ejb-jar-bnd.xml and the activation spec in WAS itself. My main question is, why do I need ALL of them? Why should/could I specify things like the queue name or destinaton type via annotation (@ActivationConfigProperty) when I still need a activation spec in WAS where I also specify the destination e.g. Queue-Name? I addition I also need a binding via an xml file? Is that right? Is it also possible to specify the activationspec-name via annotation and thus get rid of the xml binding file? Can I avoid creating the activation spec in WAS?
Hope someone can clarify things, thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您无法避免 Activation Spec 实体,因为它负责打开与 JMS 提供程序的连接,根据消息选择器过滤器等各种选项查询消息。
根据 WebSphere 7 InfoCenter EJB-3 注释可以替换绑定文件中的激活规范属性,但 WebSphere 所需的属性不是标准的。
据我所知,您必须提供:
手动编写或使用部署程序工具编辑的绑定文件
位于管理控制台或自动化 jython/wsadmin 脚本中的部署设置属性
请注意激活规范是一个运行时可以停止的组件,通常是在消息回滚之后。在这种情况下,它不再使用消息,并且您的 MDB 无需处理任何内容,直到您从 WebSphere 控制台重新激活它。
You cannot avoid the Activation Spec entity because it is responsible to open connection to your JMS provider, query messages according to various options like the message selector filter.
According to WebSphere 7 InfoCenter EJB-3 annotations can replace activation specification properties from binding file but the properties required by WebSphere are not standard.
So as far as I know, you have to provide:
either the binding file, written manually or edited with the deployer tool
either at deployment setting properties in the administrative console or in automated jython/wsadmin script
Be aware that the Activation Spec is a runtime component that can be stopped, typically after some rollbacks on messages. In that case, it no longer consumes message and your MDB has nothing to process until you re-activate it from the WebSphere console.