消息驱动bean - 部署时通知?

发布于 2024-08-07 12:37:53 字数 45 浏览 5 评论 0原文

是否有可能在 bean(本例中为 mdb)内部收到其部署过程刚刚完成的通知?

is it possible to get notified inside the bean (mdb in this case) that its deployment procedure has just finished?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

做个ˇ局外人 2024-08-14 12:37:53

我想说的是,当调用 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.

心舞飞扬 2024-08-14 12:37:53

我很确定一旦构造函数完成,它就被认为是“部署”。

好的,为了解决反对票,来自 Jave EE API文档,您有两种可用的生命周期方法:

void ejbRemove()
      A container invokes this method before it ends the life of the message-driven object.

void setMessageDrivenContext(MessageDrivenContext ctx)
      Set the associated message-driven context.

不幸的是,仅此而已。

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:

void ejbRemove()
      A container invokes this method before it ends the life of the message-driven object.

void setMessageDrivenContext(MessageDrivenContext ctx)
      Set the associated message-driven context.

Unfortunately, that's it.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文