Spring integration + logging response time for http adapters(or any endpoint) -


as part of non-functional requirements, have log response time each http-outbound calls in spring integration flow.

i have series of http:outbound-gateway's make rest api calls (request/response in json). have log different things request payload, service endpoint name, status (success/failure).

i have tried use channelinterceptoradapter like:

import org.slf4j.logger; import org.slf4j.loggerfactory; import org.springframework.integration.message; import org.springframework.integration.messagechannel; import org.springframework.integration.channel.interceptor.channelinterceptoradapter; import org.springframework.stereotype.component;  @component(value = "integrationlogginginterceptor") public class integrationlogginginterceptor extends channelinterceptoradapter  {      private static final logger logger = loggerfactory.getlogger(integrationlogginginterceptor.class);      @override     public void postsend(message<?> message, messagechannel channel, boolean sent) {         logger.debug("post send - channel " + channel.getclass());         logger.debug("post send - headers: " + message.getheaders() + " payload: " + message.getpayload() + " message sent?: " + sent);     }      @override     public message<?> postreceive(message<?> message, messagechannel channel) {         try {             logger.debug("post receive - channel " + channel.getclass());             logger.debug("post receive - headers: " + message.getheaders() + " payload: " + message.getpayload());         } catch(exception ex) {             logger.error("error in post receive : ", ex);         }         return message;     }  } 

but not able figure out how response times each http:outbound-gateway.

any pointers/suggestions/hints/advice highly appreciated.

right, should write interceptor not channel , <int-http:outbound-gateway>. there feature <request-handler-advice-chain>

it can implementation of aop advice. purpose methodinterceptor choice. advice applied abstractreplyproducingmessagehandler.handlerequestmessage, real 'hard' work done.


Comments

Popular posts from this blog

php - render data via PDO::FETCH_FUNC vs loop -

c++ - OpenCV Error: Assertion failed <scn == 3 ::scn == 4> in unknown function, -

The canvas has been tainted by cross-origin data in chrome only -