2012-03-22 51 views
2
<flow> 
<jms:inbound-endpoint queue="InputQueue"/> 
<component class="MyComponent"/> 
<choice> 
    <when expression="/Response/Status/Success" evaluator="xpath"> 
     <jms:outbound-endpoint queue="LogInputQueue"/> 
     <jms:outbound-endpoint queue="SuccessQueue"/> 
    </when> 
    <when expression="/Response/Status/Error" evaluator="xpath"> 
     <jms:outbound-endpoint queue="LogInputQueue"/> 
     <jms:outbound-endpoint queue="ErrorQueue"/> 
    </when> 
    <otherwise> 
     <jms:outbound-endpoint queue="LogInputQueue"/> 
     <jms:outbound-endpoint queue="ExceptionQueue"/> 
    </otherwise> 
</choice> 
</flow> 

在此流程中,MyComponent返回成功消息作为响应还是错误响应或异常?如何记录或处理Mule中的原始有效负载消息

我需要在LogInputQueue中的所有情况下从InputQueue中记录原始消息。我如何在我的流程中实现这一点?

回答

2

你是不是想要创建一个日志文件?在这种情况下,你必须使用SLF4J实现Log4j和使用线

<logger level="log_level" category="your_category" message="#[message:payload]"/> 

其中LOG_LEVEL是你想要的记录LEVEL-“错误”,“调试”,“信息”等...

your_category是您在log4j.properties文件中定义的日志类别(实际上是可选的)

and message =“#[expression:value]”是您的消息以表达式形式给出:scope:key combination。范围在这里是可选的。

0

使用log4j或slf4j可以记录有效负载。

[有效内容],我们在控制台中使用此日志有效内容的记录器组件。

0

,因为你需要从InputQueue在所有的情况下发送原始消息LogInputQueue,正如你所说,你需要做的是: -
1.所有的案件中删除<jms:outbound-endpoint queue="LogInputQueue"/>选择块
2.存储从原始有效载荷InputQueue在通过将其放置只是JMS入站端点
3.在流动结束后,在选择后路由器的变量,从设置在集有效载荷分量的有效载荷您存储了原始有效负载012的变量 4.现在把<jms:outbound-endpoint queue="LogInputQueue"/>放在你设置的有效负载组件后面。

这种方式,您将能够在初始有效载荷发送到LogInputQueue按您的要求

相关问题