使用 Spring DSL 配置骆驼线程名称 [英] Configure Camel Thread names with Spring DSL

查看:19
本文介绍了使用 Spring DSL 配置骆驼线程名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何配置 Camel(2.8.1 版)创建的线程名称?我需要更简洁的线程名称来记录日志.

How do I configure the thread names created by Camel (version 2.8.1)? I need to have more concise thread names for logging purposes.

Camel 文档指出默认值是:

Camel (#camelId#) thread ##counter# - #name#

这会导致以下名称:

Camel (bundle_camel) thread #114 - JmsConsumer[SomeClassNameHere]

但我只想:

#camelId#-#counter#

这会给我类似的东西:

bundle_camel-114

文档说明了如何通过调用管理器方法来更改线程名称模式,但我们只通过 Spring DSL 配置文件与 Camel 交互.

The documentation says how to change the thread name pattern by calling a manager method, but we only ever interact with Camel via the Spring DSL config files.

推荐答案

是的,您需要使用 executor 服务策略定义 并设置其模式.虽然我认为我们应该允许将命名模式配置为 <camelContext> 上的属性,您可以为 JMX 命名做这件事.我将记录一张票以在 Camel 中增强此功能(尽管 ASF JIRA 目前处于维护模式)

Yeah you would need to define a <bean> with the executor service strategy and set its pattern. Though I think we should allow to configure a naming pattern as an attribute on <camelContext> which you can do for JMX naming. I will log a ticket to get this enhanced in Camel (though ASF JIRA is currently in maintenance mode)

http://camel.apache 上查看一些详细信息.org/advanced-configuration-of-camelcontext-using-spring.htmlhttp://camel.apache.org/threading-model.html

这篇关于使用 Spring DSL 配置骆驼线程名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆