【发布时间】:2020-07-31 22:40:44
【问题描述】:
在一个 Spring Boot 应用程序中,我有一个带有 jms 监听器的类。
public class PaymentNotification{
@JmsListener(destination="payment")
public void receive(String payload) throws Exception{
//mapstring conversion
....
paymentEvent = billingService.insert(paymentEvent); //transactional method
//call rest...
billingService.save(paymentEvent);
//send info to jms
}
}
然后我看到当发生错误时,数据被插入到数据库中,没关系,但是就像一次又一次地调用接收方法......但是当我检查服务器时队列是空的。
如果出现错误,我不想再次调用方法,有什么办法吗。
【问题讨论】:
标签: spring-boot spring-data-jpa jms spring-jms