2
votes

I'm using Spring Integration DSL with ActiveMQ with concurrent consumers and trying to adjust Metrics for Spring IntegrationFlows which interacts with each other using direct channels and routers.

The typical Integration Flow looks like:

                                                -> InboundFlow1 -> Transformer|
ActiveMQ Broker ->JMS InboundAdapter -> Router |                             -> OutboundFlow -> JMS OutboundAdapter
                                                -> InboundFlow2 -> Transformer|

Each Flow contains inbound JMS Adapter, Router, Filter, Transformer and Outbound JMS Gateway.

Is there any way to gather such metrics from InboundAdapter to OutboundAdapter:

  • Amount of messages per second;
  • The total amount of messages;
  • Min transferring time through the flow ;
  • Max transferring time through the flow;
  • The average time of transferring through the Flow;
  • Amount of Erroneous messages;
  • Duration of handling a message;

I've tried solutions proposed with MessageChannelMetrics:

https://docs.spring.io/spring-integration/reference/html/system-management-chapter.html#mgmt-channel-features https://github.com/spring-projects/spring-integration-samples/tree/master/intermediate/monitoring Spring Integration Channel Statistics Metrics

But they aren't covered needed functionality.

1

1 Answers

1
votes

Everything except the first and last are present; the first can be derived; the last one would mean capturing it for each message which would be expensive.

However, Spring Integration 5.0.4 now supports Micrometer in addition to those standard metrics.

EDIT

Also, you can always add a custom metrics factory if the standard metrics don't do what you need docs here.

Just write your own subclass of AbstractMessageHandlerMetrics to capture whatever you want.