java - how to implement analytics in spring integration project? -
i working on spring integration project , want implement analytics. basic idea capture method name, timestamp , number of times called in gateways.
is there default package / class available log these details?
here thought , need suggestion before proceed further
step 1 : add method name gateway method header
<int:gateway id="gateway" service-interface="org.pro.gateway.samplegateway"> <int:method name="method1" request-channel="request.input.channel" reply-channel="reply.output.channel"> <int:header name="methodname" value="placeorder"/> </int:method> </int:gateway>
step 2 : add spring wire tap interceptor, apply pattern matches input channel. message header name in wiretap channel , log it.
<int:wire-tap channel="wiretapchannel" pattern="input*" /> <int:service-activator ref="analyticsbean" method="footprint" input-channel="wiretapchannel" output-channel="outputchannel"/> <bean id="analyticsbean" class="org.pro.stat.analyticservice"/>
step 3 : implementation code
public class analyticsservice { public void footprint(message<string> msg){ string methodname = msg.getheaders().get("methodname"); long timestamp = msg.getheaders().gettimestamp(); /* send service / store in file incremented value */ storeit(methodname, timestamp); }}
your steps good. however, why not make analytics service use @async (using task executor service in spring) not consuming load on parent thread.