2011-07-22 11 views
0

私は春3.0.5を使用し、休止状態です。バネの問題。コミット後にインターセプタが呼び出される方法を教えてください。

  1. インターセプタが動作しています。
  2. jmsキューにドメインIDを送信します。
  3. コンシューマーはそれを受け取り、ドメインを検索しますが、データベースのコミットよりも高速で、nullを返します。
  4. db commit後にインターセプタを呼び出す方法を教えてください。

    appCtx.xml

    <tx:annotation-driven order="10" /> 
    
    
    <bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager"> 
         <property name="entityManagerFactory" ref="entityManagerFactory" /> 
        </bean> 
    
    <aop:aspectj-autoproxy /> 
    
    <bean id="domainProducerHandler" depends-on="domainEventService" 
         class="org.test.service.DomainProducerHandler" factory-method="aspectOf"> 
         <property name="domainEventService" ref="domainEventService" /> 
         <property name="order" value="1" /> 
    </bean> 
    
    ===================service class===================== 
    @SendDomainEvent 
    @Transactional 
    public ProtoMessage sendDonation(String aa) { 
        Domain domainObj = new Domain(); 
        domainRepository.saveAndFlush(domainObj); 
    
        return domain; 
    } 
    
    
    ==================interceptor class===================** 
    
    
    
    
        @AfterReturning(
        pointcut="@annotation(org.test.service.SendDomainEvent)", 
        returning="retVal") 
    public void processDomainReturn(Object retVal) {   
    
    .... 
    
    try {  
        domainEventService.publishToQueue(endDonationSuccessEvent); 
    } catch (Exception e) { 
        log.error("error during send endDonationSuccessEvent: " + e); 
    } 
    

    }

インターセプタクラスが実装するインターフェイスを命じました。注文パラメータをtxに設定しました。注釈主導の注文= "10"ですが、動作しません。

答えて

0

「注文パラメータ」とはどういう意味ですか? Spring AOPでサポートされているordering adviceの方法は、@Ordered annotationまたはorg.springframework.core.Orderedインターフェイスを使用します。このインターフェイスでは、優先度の高いものと低いものの定数も定義されています。

+0

@orderアノテーションがあります。 – iddqd

関連する問題