获取mule catch异常策略中的异常信息

时间:2016-06-05 10:04:58

标签: exception mule mule-studio

我在我的mule流程中使用了catch异常策略(v3.7.3)。如果在我的流程中抛出异常。我想在catch异常策略中检索异常。

骡子异常流程:

library(ggplot2)
library(maps)
library(mapdata)


xlim <- c(5, 10)
ylim <- c(60, 62)

norwaymap <- map_data("worldHires", "Norway")
a <- ggplot(norwaymap, aes(x = long, y = lat, group = group)) +
  geom_polygon(colour = NA, fill = "grey60") +
  geom_rect(xmin = xlim[1], xmax = xlim[2], ymin = ylim[1], ymax = ylim[2], 
    colour = "red", fill = NA) +
  coord_map(xlim = c(3, 33), ylim = c(57, 72))
print(a) # super slow

在我的ExceptionTransformer.java中,我想处理异常并获取异常对象(以打印堆栈跟踪)

ExceptionTransformer.java

<choice-exception-strategy
        doc:name="Choice Exception Strategy">
        <catch-exception-strategy
            when="exception.causedBy(com.nc.exception.NcException)"
            doc:name="Notification Center Exception Strategy">
            <custom-transformer
                class="com.zoto.nc.transformer.json.ExceptionTransformer" doc:name="Exception Transformer">
            </custom-transformer>
        </catch-exception-strategy>
    </choice-exception-strategy>

有没有办法在ExceptionTrasformer类中获取异常堆栈跟踪?

1 个答案:

答案 0 :(得分:0)

你应该做的是向MuleMessage询问它的ExceptionPayload,它有抛出异常,你可以获得跟踪。那是message.getExceptionPayload()