AppDynamics Application Intelligence Platform
3.9.x Documentation
In Spring-based applications, Spring Integration enables lightweight messaging and supports integration with external systems via declarative adapters.
The App Agent for Java by default automatically discovers exits for all Spring Integration Release 2.2.0 channels except 'DirectChannel.'
See the Sample Application Flow XML below.
AppDynamics Pro Agent for Java supports tracking application flow through Spring Integration messaging channels. The App Agent for Java Spring Integration support is based on the MessageHandler interface.
For pollable channels:
Originating transactions begin with MessageHandler.handleMessage() implementations. If the incoming message is already recognized by the App Agent for Java then a continuing transaction is started.
Exit points are based on MessageChannel.send(). Most of these message channels are typically inside the JVM so the Application Flow Maps shows a link from the tier to the message channel component name (bean name) and back.
In cases where a lot of application flow happens before the first MessageHandler gets executed, you should enable tracking the application flow as follows:
To safeguard against cases where pollableChannel.receive() is not called inside a loop, you can ensure that the App Agent for Java tracks a pollable channel loop only if it happens inside a class/method combination similar to that defined in the following example. Configure the spring-integration-receive-marker-classes node property for each class/method combination that polls messages in a loop, then only those class/methods identified in this node property are tracked.
class MessageProcessor { void process() { while(true) { Message message = pollableChannel.receive() } } }
For example, for the loop above, set the spring-integration-receive-marker-classes node property as follows and restart the application server:
spring-integration-receive-marker-classes=MessageProcessor/process
Note: The spring-integration-receive-marker-classes node property must be configured before the method process() gets executed for any changes to take effect. Restart the application server after setting this property.
The following XML specifies the integration flow configuration of the application tracked in the image above.
<?xml version="1.0" encoding="UTF-8"?> <beans:beans xmlns="http://www.springframework.org/schema/integration" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:beans="http://www.springframework.org/schema/beans" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration.xsd"> <channel id="inputChannel"> <queue capacity="100"/> </channel> <channel id="out"/> <bridge input-channel="inputChannel" output-channel="out"> <poller max-messages-per-poll="10" fixed-rate="5000"/> </bridge> <channel id="outputChannel"> <queue capacity="100"/> </channel> <service-activator input-channel="out" output-channel="outputChannel" ref="helloService" method="sayHello"/> <channel id="out2"> <queue capacity="100"/> </channel> <bridge input-channel="outputChannel" output-channel="out2"> <poller max-messages-per-poll="10" fixed-rate="5000"/> </bridge> <beans:bean id="helloService" class="org.springframework.integration.samples.helloworld.HelloService"/> </beans:beans>
In the following statements, you can see Spring Integration channels that are recognized and identified in the Application Flow Map visualized above:
<channel id="out">
<channel id="outputChannel">