当Spring Integration位于类路径

时间:2015-07-01 08:18:40

标签: spring spring-boot spring-integration codahale-metrics

在我的spring-boot应用程序中(在classpath中使用spring-integration),我无法重置任何指标计数器。 它抛出ClassCastException:

Exception in thread "metricsExecutor-1" org.springframework.messaging.MessageDeliveryException: Failed to handle GenericMessage [payload=delete, headers={timestamp=1435738406974, id=4c9aaac0-8bf1-aac1-d9c9-6f8d50f7801b, metricName=counter.test.toto}] to org.springframework.messaging.support.ExecutorSubscribableChannel$SendTask@2e9f560 in org.springframework.boot.actuate.metrics.writer.MetricWriterMessageHandler@4dec731e; nested exception is java.lang.ClassCastException: java.lang.String cannot be cast to org.springframework.boot.actuate.metrics.Metric
    at org.springframework.messaging.support.ExecutorSubscribableChannel$SendTask.run(ExecutorSubscribableChannel.java:144)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.ClassCastException: java.lang.String cannot be cast to org.springframework.boot.actuate.metrics.Metric
    at org.springframework.boot.actuate.metrics.writer.MetricWriterMessageHandler.handleMessage(MetricWriterMessageHandler.java:46)
    at org.springframework.messaging.support.ExecutorSubscribableChannel$SendTask.run(ExecutorSubscribableChannel.java:135)
    ... 3 more

我认为这是messageChannel的一个错误,所以有没有办法禁用它?

1 个答案:

答案 0 :(得分:1)

正在向String订阅的频道发送带有"delete"有效负载(MetricWriterMessageHandler)的消息。它只希望看到DeltaMetric个有效负载。

如果您打开DEBUG日志记录,您应该能够找出将虚假消息发送到频道的内容。

如果您确定它的启动代码,请在GitHub中打开引导问题。