简体   繁体   English

EJB 3中的失败重试

[英]Failure retry in EJB 3

We have recently migrated our EJB 2 application to EJB 3.In EJB2 if some failures in onMessage container will be able to do retry the message on configured number of times however in EJB3 there is no such option.Could someone help on this. 我们最近将EJB 2应用程序迁移到了EJB 3.在EJB2中,如果onMessage容器中的某些故障将能够按配置的次数重试该消息,但是在EJB3中则没有这样的选择,有人可以提供帮助。

Can we explicitly sleep the thread and do explicitly retry in onMessage? 我们可以显式地休眠线程并在onMessage中显式重试吗?

Thanks in advance . 提前致谢 。

  1. If you are using @TransactionManagement(value= TransactionManagementType.CONTAINER) that is container managed transaction then on exception, message will be retired 10 time before the message is send to the DLQ. 如果您使用的是@TransactionManagement(value= TransactionManagementType.CONTAINER) ,它是容器管理的事务,那么在异常情况下,消息将在消息发送到DLQ之前10倍退出。
  2. If you are not using Activemq RA then, following two documents can be useful to you if you are having Container-Managed Transaction Redelivery and Exception Handling and Managing Rolled Back, Recovered, Redelivered, or Expired Messages 如果您不使用Activemq RA,则如果您具有容器管理的事务重新交付和异常处理以及管理回滚,恢复,重新传递或过期的消息 ,则以下两个文档对您很有用
  3. If you are using ActiveMq resource adapter, use can use MaximumRedeliveries Resource Adapter properties 如果您使用的是ActiveMq资源适配器,则可以使用MaximumRedeliveries 资源适配器属性
  4. Else, if you want to retry only on specific exception then you can catch the exception and then send the message back to the same queue and with this additional property. 否则,如果只想重试特定的异常,则可以捕获该异常,然后使用此附加属性将消息发送回相同的队列。 Activemq consume message after delay interval Also, set the retry count in the message header so that you can keep the track of the retries. 延迟间隔后Activemq消耗消息此外,在消息头中设置重试计数,以便您可以跟踪重试。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM