[英]How can implement AbstractAnnotationConfigDispatcherServletInitializer for java config on my spring 3.2 and hibernate 4 integration project?
[英]how to implement analytics in spring integration project?
我正在從事Spring Integration Project,並且想實施分析。 基本思想是捕獲所有網關中調用的方法名稱,時間戳和次數。
有沒有可用的默認程序包/類來記錄這些詳細信息?
這是我想做的事,需要提出建議,然后再繼續
步驟1:添加方法名稱為網關方法標頭
<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>
第2步:添加Spring Wire分接攔截器,應用僅與輸入通道匹配的樣式。 在竊聽通道中按名稱獲取消息頭並將其記錄。
<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"/>
步驟3:實施代碼
public class AnalyticsService {
public void footprint(Message<String> msg){
String methodName = msg.getHeaders().get("methodName");
long timestamp = msg.getHeaders().getTimestamp();
/* Send to some service / store it in file with incremented value */
storeIt(methodName, timestamp);
}}
你的腳步看起來不錯。 但是,為什么不讓Analytics Service使用@Async(在春季使用Task executor服務),從而不占用父線程的負載。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.