1
votes

I have deployed a Web service using Apache Came and Apache CXF and "code first" approach. It works fine.

<cxf:cxfEndpoint id="operacionesWSEndpoint" address="/operaciones"
    serviceClass="foo.bar.OperacionesService">
</cxf:cxfEndpoint>

but I want to measure the performance of my service and log it. For that, I use Spring AOP using the following pointcut

@Pointcut("execution(* foo.bar.OperacionesService.*(..))")
public void operacionsMethods() {

}

@Around("operacionsMethods()")
public Object logTimeMethod(final ProceedingJoinPoint joinPoint) throws Throwable {

    StopWatch stopWatch =
            new StopWatch(joinPoint.getTarget().getClass().getSimpleName() + "."
                + joinPoint.getSignature().getName());
    stopWatch.start();

    Object retVal = joinPoint.proceed();

    stopWatch.stop();

    log.debug("performance: {}", stopWatch.shortSummary());

    return retVal;
}

Well, is not working. Other methods and services are being logged using the same approach (AOP), but not the Web Service exposed by Camel.

I don't think there is any error with my code: service is working as well as other aspects. I feel I am missing something here regarding Apache Camel - CXF and Spring AOP and I did not find a similar problem.

Any ideas?

1
years ago asked, but still - did you find a solution to this back then? - Laimoncijus

1 Answers

0
votes

I haven't tried camel and Spring AOP, but you could use a camel interceptor, as an alternative. This isn't quiet what you wanted. Also, for measuring you could use a 'meter' and Slf4jReporter from the metrics library.