Hi Folks,

 

I am trying to measure the time taken for the CXF BC to enter and exit from
a Consume as well as Provider BC.

 

I am trying using Spring AOP.

 

Below are the list of issues which I am facing when I try to use Spring AOP
and measure the performance.

 

The same was working on SMX-3.X

 

I changed the the cutpoint-id from
org.apache.servicemix.jbi.nmr.flow.Flow.send(..)) to
org.apache.servicemix.jbi.runtime.impl.DeliveryChannelImpl.send(..))

 

 

And there is no change in the application descriptor file, it remains the
same as,

 

<beans xmlns="http://www.springframework.org/schema/beans";

      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";

      xmlns:aop="http://www.springframework.org/schema/aop";

      xsi:schemaLocation="

       http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd

       http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-2.0.xsd";>

 

  <!-- Turn on AspectJ auto-proxying -->

      <aop:aspectj-autoproxy/>

  

  <!-- Create performance advisor aspect -->

      <bean id="performanceAdvice"
class="abc.xyz.boo.far.PerformanceAdvice"/>

 

Also I have an entry in SMX4_HOME/etc/org.ops4j.pax.logging.cfg for the
abc.xyz.boo.far.PerformanceAdvice to log the performance data as follows,

 

 

log4j.logger.urn.mb.library.aop=INFO, PerformanceAdvisorLogger

log4j.appender. PerformanceAdvisorLogger
=org.apache.log4j.RollingFileAppender

log4j.appender.
PerformanceAdvisorLogger.layout=org.apache.log4j.PatternLayout

log4j.appender.
PerformanceAdvisorLogger.layout.ConversionPattern=%d{ABSOLUTE} | %-5.5p |
%-16.16t | %-32.32c{1} | %X{bundle.id} - %X{bundle.name} -
%X{bundle.version} | %m%n

log4j.appender.
PerformanceAdvisorLogger.file=${karaf.data}/log/performancedata.log

log4j.appender. PerformanceAdvisorLogger.append=true

log4j.appender. PerformanceAdvisorLogger.maxFileSize=10MB

log4j.appender. PerformanceAdvisorLogger.maxBackupIndex=10

 

and I have my abc.xyz.boo.far.PerformanceAdvice.java as follows,

 

import javax.jbi.messaging.MessageExchange;

 

import org.apache.commons.logging.Log;

import org.apache.commons.logging.LogFactory;

import org.aspectj.lang.ProceedingJoinPoint;

import org.aspectj.lang.annotation.Around;

import org.aspectj.lang.annotation.Aspect;

 

@Aspect

public class PerformanceAdvice {

    private static final transient Log LOG

        = LogFactory.getLog(PerformanceAdvice.class);

//SMX-4 AOP Workaround.

//@Around("execution(*
org.apache.servicemix.jbi.nmr.flow.Flow.*send.*(..))")

//@Around("execution(* org.apache.servicemix.jbi.nmr.flow.Flow.send(..))")

@Around("execution"

+

"(* org.apache.servicemix.jbi.runtime.impl.DeliveryChannelImpl.send(..))")

//+ "(*
org.apache.servicemix.nmr.core.StraightThroughFlow.*dispatch.*(..))")

//"(* org.apache.servicemix.nmr.api.internal.Flow.*dispatch.*(..))")

    public final Object measurePerformance(

            final ProceedingJoinPoint thisJoinPoint) {

LOG.info("Entering Inside PerformanceAdvice.measurePerformance()");

        Object ret = null;

        try {

            MessageExchange me = (MessageExchange)
thisJoinPoint.getArgs()[0];

            String role;

            if (me.getRole() == MessageExchange.Role.PROVIDER) {

                role = "PROVIDER";

            } else {

                role = "CONSUMER";

            }

 

            LOG.info("PerformanceAdvice.measurePerformance() Start : "

                    + me.getEndpoint().getServiceName()

                    + " (status: " + me.getStatus()

                    + ", role: "  + role + ")");

 

            long startTime = System.currentTimeMillis();

 

            ret = thisJoinPoint.proceed();

 

            long endTime = System.currentTimeMillis();

            LOG.info("PerformanceAdvice.measurePerformance() Finished : "

            + me.getEndpoint().getServiceName()

                    + " in " + (endTime - startTime) + " ms.");

 

        } catch (Throwable e) {

            e.printStackTrace();

       }

       return ret;

   }

}

 

 

But no lo comes up in the configured log file.

 

Can someone can shed some light on this particular issue.

 

Any help is genuinely appreciated.

 

Best Regards,

K.B.K

Reply via email to