您可以收听SpringCamelContext状态吗?

发布于 2025-01-26 17:23:09 字数 543 浏览 2 评论 0原文

使用EventNotifierSupport,我可以听CamelContextStartedEvent。但是,在所有其他路线已经初始化之后,我需要在上下文中添加一个根。目前,该事件发生在初始化CamelContext之后发生,但是在此之后,我们添加了数百条SpringCamelContext路线,据我了解,没有“ SpringCamelContextStarteDedevent”,所以我不知道如何在所有其他路线已经添加所有其他路线之后,初始化。我怀疑我的逻辑存在根本错误,如果我在某个地方错了,请纠正我。

    @Override
    public void notify(EventObject event) throws Exception {
        if (event instanceof CamelContextStartedEvent) {
            log.info("CamelContextStartedEvent for {}", event.getSource());
            startWarmupThread();
        }
    }

Using EventNotifierSupport, I can listen for CamelContextStartedEvent. However, I need to add one more root to the context, after all the other routes have already been initialized. Currently, the event occurs after camelcontext have been initialized, but after that we have hundreds of SpringCamelContext routes added, and as I understand, there is no "SpringCamelContextStartedEvent", so I have no idea of how to add route after all other routes are already initialized. I suspect that there is fundamental error in my logic, please correct me if I am wrong somewhere.

    @Override
    public void notify(EventObject event) throws Exception {
        if (event instanceof CamelContextStartedEvent) {
            log.info("CamelContextStartedEvent for {}", event.getSource());
            startWarmupThread();
        }
    }

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文