【问题标题】:camel : stackoverflow error when route is called recursively骆驼:递归调用路由时出现stackoverflow错误
【发布时间】:2018-07-10 04:24:00
【问题描述】:

我有一条骆驼路线,它会调用自己,直到满足某个条件。基本上这个想法是实现路由的重试。部署应用程序时,如果长时间重试,我会收到 stackoverflow 错误。

    [Camel (camel-1) thread #1 - Multicast] ERROR com.application.RouteName.lambda$configure$0 - Exception occurred during execution on the exchange: Exchange[ID-batchrater-310822922-1-383133832-34058-1530798326741-0-6]
    org.apache.camel.CamelExecutionException: Exception occurred during execution on the exchange: Exchange[ID-batchrater-310822922-1-383133832-34058-1530798326741-0-6]
        at org.apache.camel.util.ObjectHelper.wrapCamelExecutionException(ObjectHelper.java:1779)
        at org.apache.camel.impl.DefaultExchange.setException(DefaultExchange.java:351)

  .
  .
  .
  .
        Caused by: java.lang.StackOverflowError: null
        at org.springframework.beans.factory.support.AbstractBeanFactory.transformedBeanName(AbstractBeanFactory.java:1117)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:239)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)
        at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1084)
        at org.apache.camel.spring.spi.ApplicationContextRegistry.lookupByNameAndType(ApplicationContextRegistry.java:47)
        at org.apache.camel.impl.PropertyPlaceholderDelegateRegistry.lookupByNameAndType(PropertyPlaceholderDelegateRegistry.java:63)
        at org.apache.camel.component.bean.BeanInfo.createParameterMappingStrategy(BeanInfo.java:177)
        at org.apache.camel.component.bean.BeanInfo.<init>(BeanInfo.java:99)

我认为 stackoverflow 错误是由于递归调用 route 造成的,我更改了 route 结构,现在重新传递由 camel onException() 中可用的 retryDelivery 机制处理。并且在满足条件之前,我的重试次数可以是无限的。

我需要知道使用这种方法是否有机会再次stackOverFlow

【问题讨论】:

    标签: java apache apache-camel


    【解决方案1】:

    不,这是使用 onException 和其他错误处理功能处理错误处理重新交付的正确方法。使用循环 EIP 会导致更长的堆栈帧,不应该用于很长的循环。所以你做了正确的修复。

    【讨论】:

      猜你喜欢
      • 2015-09-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-09-05
      • 1970-01-01
      • 2018-09-02
      相关资源
      最近更新 更多