Announcement Announcement Module
Collapse
No announcement yet.
serviceactivator outbound channel question. Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • serviceactivator outbound channel question.

    We had spring BeanNameAutoProxyCreator with bean="processor" with transactionInterceptor on method invoke().

    Since when the service-activator completes it seems to end the Transaction.

    So, we removed the output-channel on the service-activator and injected the channel inside service-activator bean "processor" and doing a channel.send() inside the invoke() of the bean.

    The Transaction seems to be working fine. We didn't want the transaction boundaries to end there and everything is working as expected.

    But, are there any repercussions in doing so? Please suggest.

    We have a transaction-interceptor, service-activator and a bean like this:

    Furthermore, I know that there is a transaction manager inside poller but we didn't want to use any pollers because we don't our code to wait for a certain amount of time in the middle because it is a time-critical application.

    Code:
    
    <bean abstract="true" id="transactionTemplate" class="org.springframework.aop.framework.autoproxy.BeanNameAutoProxyCreator">
            <property name="interceptorNames">
                <list>
                    <value>transactionAdvisor</value>
                </list>
            </property>
        </bean>
    
    
        <bean id="transactionAdvisor" class="org.springframework.aop.support.DefaultPointcutAdvisor">
            <property name="pointcut" ref="gridPointCut"/>
            <property name="advice" ref="transactionInterceptor"/>
        </bean>
    
        <bean id="gridPointCut" class="org.springframework.aop.support.NameMatchMethodPointcut">
            <property name="mappedNames">
                <list>
                    <value>invoke</value>
                </list>
                </property>
        </bean>
    
        <bean id="transactionInterceptor"
              class="org.springframework.transaction.interceptor.TransactionInterceptor">
            <property name="transactionManager" ref="transactionManager"/>
            <property name="transactionAttributes">
                <props>
                    <prop key="invoke">PROPAGATION_REQUIRED</prop>
                </props>
            </property>
        </bean>
    
        <!-- Wrap that AOPed translation bean within a transaction framework -->
        <bean id="transactionProxyFactory" parent="transactionTemplate">
            <property name="beanNames">
                <list>
                    <value>processor</value>
                </list>
            </property>
        </bean>
    
    
    <channel id="outboundChannel"/>
    
    <service-activator input-channel="inboundChannel" ref="processor" method="invoke"/>
    
    <bean id="processor" class="com.xx.Processor">
    <property name="outboundChannel" ref="outboundChannel"/>
    </bean>
    
    Inside Processor class
    
    ... channel.send(message);
Working...
X