On my spring-boot application (with spring-integration in classpath), i cannot reset any metrics counter. It throw 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
I think this is a bug with messageChannel so is there a way to disable it ?
Something is sending a message with a String
payload ("delete"
) to the channel that the MetricWriterMessageHandler
is subscribed to. It only expects to see Delta
or Metric
payloads.
If you turn on DEBUG logging you should be able to figure out what's sending the bogus message to the channel.
If you determine it's boot code, open an issue against boot in GitHub.