如何在停止CamelContext时获取通知,API具有addStartupListener但在上下文停止时没有类似的通知?Apache Camel:关于CamelContext的通知停止
1
A
回答
2
这个问题也问骆驼邮件列表上 http://camel.465427.n5.nabble.com/Notification-on-CamelContext-stop-tp5729300.html
有几种方法。一个像Evgeniy Dorofeev展示生命周期策略一样。 http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/spi/LifecycleStrategy.html
另一个是使用Event对象的事件通知程序,它具有比生命周期策略更多的事件。比如这个例子所示为:http://camel.apache.org/eventnotifier-to-log-details-about-all-sent-exchanges.html
如果你使用Spring或蓝图XML,那么你可以通过定义一个bean配置它们,骆驼将它捡起来作为记录在这里:http://camel.apache.org/advanced-configuration-of-camelcontext-using-spring.html
1
这是一种方法
camelContext.addLifecycleStrategy(new LifecycleStrategySupport() {
@Override
public void onContextStop(CamelContext context) {
}
});
看到更多的克劳斯易卜生的答案之一,他是骆驼的行动作者http://www.manning.com/ibsen/
相关问题
- 1. 获取异常org.apache.cxf.interceptor.Fault:org/apache/camel/CamelContext
- 2. Apache Camel上下文自动停止
- 3. Apache Camel中camelContext和routeContext的区别是什么
- 4. Apache Camel将XML路由和Bean从文件加载到CamelContext中
- 5. Apache Camel中的开关盒
- 6. 用于Websphere的Apache Camel Classloader
- 7. 通知在状态栏中,当通知关闭时停止asynctask
- 8. Apache中的REST通过Apache Camel
- 9. Google推送通知:停止通知
- 10. 通知家长关于线程终止
- 11. 使用复制启动/停止Apache Camel远程路由
- 12. Apache Camel - 停止执行并返回失败消息
- 13. 关于通知()
- 14. 停止推送通知
- 15. Android:停止声音通知
- 16. 停止本地通知
- 17. 停止推送通知
- 18. MPMusicPlayerController停止发送通知
- 19. 未收到最小负载下的Apache Camel事件通知
- 20. Apache camel ftp组件 - 成功传输的通知
- 21. Apache Camel Main-Class及其方法启动,停止,运行,暂停和恢复
- 22. 关于通知iOS
- 23. 用于C#和Java EDA的Apache Camel ESB
- 24. Rails中的Apache Camel相当于
- 25. 用于Apache Camel URI评估的SpEL
- 26. Apache Camel中的直通处理
- 27. 如何停止有关Xcode版本更新的App Store通知?
- 28. Apache Camel SFTP .filepart
- 29. Apache Camel架构
- 30. Apache Camel Enricher