消息驱动bean - 部署时通知?
是否有可能在 bean(本例中为 mdb)内部收到其部署过程刚刚完成的通知?
is it possible to get notified inside the bean (mdb in this case) that its deployment procedure has just finished?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我想说的是,当调用
setMessageDrivenContext
时,您的 bean 就已部署 - 您知道容器有一个上下文并将其分配给您的 MDB。您的设计问题在于 MDB 是被动组件,在消息传递给它们之前,它们不应该执行任何操作。
I would say that when
setMessageDrivenContext
is called, that's your bean deployed - you know that the container has a context and has assigned it to your MDB.The problem with your design is that MDBs are passive components, they're not supposed to do anything until a message gets delivered to them.
我很确定一旦构造函数完成,它就被认为是“部署”。
好的,为了解决反对票,来自 Jave EE API文档,您有两种可用的生命周期方法:
不幸的是,仅此而已。
I'm pretty sure once the constructor is complete it's considered to be "deployed."
Okay, to address the downvote, from the Jave EE API documentation, you have two lifecycle methods available to you:
Unfortunately, that's it.