2014-04-28 48 views
0

拋出一個自定義異常的騾子流,我使用:訪問入境財產和拋出異常 - 騾子

<sub-flow name="throwException"> 
    <scripting:transformer> 
    <scripting:script engine="Groovy"> 
     throw new mypackage.MyCustomException(); 
    </scripting:script> 
    <scripting:transformer> 
</sub-flow> 

在這裏,而拋出例外,我需要發送的入站屬性的值。例如:

throw new mypackage.MyCustomException("value of inbound variable"); 

我需要用入站變量的值替換上面的字符串。如何在這個groovy腳本中訪問eventContext/mulemessage/payload /任何範圍變量?

回答

1
throw new mypackage.MyCustomException(message.getInboundProperty('some_variable_name')); 

在腳本上下文可用對象的列表,請參閱Script Context Bindingshere

+0

Thanks @Anton Kupias ... that worked – tortoise