Announcement Announcement Module
Collapse
No announcement yet.
Service Activator not firing AOP advice Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Service Activator not firing AOP advice

    I have a bean that is referenced in a service activator (lets call this exampleSpringIntegrationHandler). This bean uses a service bean (called exampleService) that is advised by some AOP advices located in exampleAdvice. When I call the exampleService bean from a standard spring area (like a mvc controller) the advice fires as expected but when the exampleSpringIntegrationHandler calls the service, the advice does not fire. I am not sure why spring integration would stop the AOP advice from firing. We have other SI flows that are using AOP in this same advice class and they are working. It just doesn't seem to want to work in this one specific case. Does anyone know what might be happening here? I have tried to include as much of the definitions as I though might be needed. Please let me know if you need more information. Thanks in advance.

    Spring Integration definitions:
    Code:
    <integration:channel id="inboundExampleRequestChannel"/>
    <integration:channel id="inboundExampleResponseChannel"/>
    <integration:service-activator id="exampleServiceActivator" input-channel="inboundExampleRequestChannel" output-channel="inboundExampleResponseChannel" ref="exampleSpringIntegrationHandler" method="start"/>
    Bean Definitions and AOP:
    Code:
    <bean id="exampleSpringIntegrationHandler" class="com.example.application.ExampleSpringIntegrationHandler">
        <property name="exampleService" ref="exampleService"/>
    </bean>
    <bean id="exampleAdvice" class="com.example.appplication.ExampleAdvice"/>
    
    <bean id="exampleSpringIntegrationHandler" class="com.example.application.ExampleSpringIntegrationHandler">
        <property name="exampleService" ref="exampleService"/>
    </bean>
    
    <bean id="exampleService" class="com.example.application.ExampleServiceImpl"/>
    
    <aop:config>
        <aop:aspect id="testAspect" ref="exampleAdvice">
            <aop:pointcut id="exampleAfterReturnPointcut" expression="execution(* com.example.application.ExampleServiceImpl.getMessages(..))"/>
            <aop:after-returning pointcut-ref="exampleAfterReturnPointcut" method="doSomething" returning="messages"/>
        </aop:aspect>
    </aop:config>
    Java Code:
    Code:
    public class ExampleSpringIntegrationHandler {
        public ExampleObject start(ExampleObject obj, Map<String, Object> headers) {
            List msgs = this.exampleService.getMessages();
            // ...
        }
    }
    
    public class ExampleAdvice {
        public void doSomething(List messages) {
            // ...
        }
    }
    
    public class MessageArchivalServiceImpl {
        public List getMessages() {
            // ...
        }
    }
Working...
X