java - 如何证明camel已经发生了 throttle

标签 java apache-camel throttling

我想知道是否有办法执行诸如 System.out.println(); 之类的操作或记录已发生的限制。目前我可以查看是否发生限制的唯一方法是将rejectExecution 设置为True。问题在于,如果它设置为 true,则在发生限制时不会处理请求。有没有办法通知使用 Camel 发生了 throttle ?

最佳答案

Camel 中的 Throttler EIP 是使用类 Throttler 实现的从 DelayProcessorSupport 延伸它在跟踪级别记录有关其处理的消息,以便您可以将其日志记录配置为跟踪级别。 例如,如果您正在使用 log4j 那么您可以使用,

log4j.logger.org.apache.camel.processor.DelayProcessorSupport=TRACE ,file

log4j.appender.file=org.apache.log4j.RollingFileAppender
log4j.appender.file.File=D:/output.log
log4j.appender.file.MaxFileSize=5MB
log4j.appender.file.MaxBackupIndex=10
log4j.appender.file.layout=org.apache.log4j.PatternLayout
log4j.appender.file.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n

关于java - 如何证明camel已经发生了 throttle ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46641209/

相关文章:

java - 如何确保单例消息驱动 Bean 一次处理一条消息?

java - 将 Jasper 报告中的数字转换为字母

java - 将响应编码为 Gzip 导致无法在浏览器中设置 Cookie

apache-camel - Apache Camel : Route from camel tomcat servlet to cxfbean component

spring - Camel 之春 : No component found with scheme: sftp

java - 多个用户的 csv 并发处理

java - 具有 Spring Security 的外部 SSO

spring-boot - apache camel 与 Spring Boot 2.0 兼容吗?

swift - Throttle 发布者如何在 Swift Combine 中工作?

java - Guava RateLimiter 爆破