在骡的Catch Exception策略中混合表达式3.3

问题描述:

我试图在我的Mule流中实现错误处理逻辑,并且我想测试HTTP状态代码。我已经实现了一个Message过滤器,并且希望我的catch-exception-strategy能够捕获org.mule.api.routing.filter.FilterUnacceptedExceptionmessage-property-filter抛出,我可以这样做,但我希望它几乎嵌套,但我知道我不能这样做,所以我将我的逻辑语句由AND操作,就像这样:在骡的Catch Exception策略中混合表达式3.3

<catch-exception-strategy when="#[exception.causedBy(org.mule.api.routing.filter.FilterUnacceptedException) &amp;&amp; header:INBOUND:http.status=404]" doc:name="Catch Exception Strategy"> 

如何过,当它被击中,这是导致我流的错误:

[11-03 19:42:33] ERROR CatchMessagingExceptionStrategy [[fault_test].connector.http.mule.default.receiver.02]: 
******************************************************************************** 
Message    : Message has been rejected by filter. Message payload is of type: ReleasingInputStream 
Code     : MULE_ERROR--2 
-------------------------------------------------------------------------------- 
Exception stack is: 
1. Message has been rejected by filter. Message payload is of type: ReleasingInputStream (org.mule.api.routing.filter.FilterUnacceptedException) 
    org.mule.routing.MessageFilter:100 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/routing/filter/FilterUnacceptedException.html) 
-------------------------------------------------------------------------------- 
Root Exception stack trace: 
org.mule.api.routing.filter.FilterUnacceptedException: Message has been rejected by filter. Message payload is of type: ReleasingInputStream 
    at org.mule.routing.MessageFilter.filterUnacceptedException(MessageFilter.java:100) 
    at org.mule.processor.AbstractFilteringMessageProcessor.handleUnaccepted(AbstractFilteringMessageProcessor.java:62) 
    at org.mule.processor.AbstractFilteringMessageProcessor.process(AbstractFilteringMessageProcessor.java:48) 
    + 3 more (set debug level logging or '-Dmule.verbose.exceptions=true' for everything) 
******************************************************************************** 

[11-03 19:42:33] ERROR CatchMessagingExceptionStrategy [[fault_test].connector.http.mule.default.receiver.02]: Failed to dispatch message to error queue after it failed to process. This may cause message loss.Logging Message here: 

org.mule.DefaultMuleMessage 
{ 
    id=856cd942-2618-11e2-9e97-f5a070de55a6 
    payload=org.mule.transport.http.ReleasingInputStream 
    correlationId=<not set> 
    correlationGroup=-1 
    correlationSeq=-1 
    encoding=UTF-8 
    [email protected] 

Message properties: 
    INVOCATION scoped properties: 
    INBOUND scoped properties: 
    Connection=true 
    Content-Type=text/xml;charset=UTF-8 
    Date=Sat, 03 Nov 2012 07:42:32 CDT 
    Keep-Alive=true 
    MULE_ENCODING=UTF-8 
    MULE_SESSION=rO0ABXNyACNvcmcubXVsZS5zZXNzaW9uLkRlZmF1bHRNdWxlU2Vzc2lvbi7rdtEW7GGKAwAEWgAFdmFsaWRMAA1mbG93Q29uc3RydWN0dAAmTG9yZy9tdWxlL2FwaS9jb25zdHJ1Y3QvRmxvd0NvbnN0cnVjdDtMAAJpZHQAEkxqYXZhL2xhbmcvU3RyaW5nO0wAD3NlY3VyaXR5Q29udGV4dHQAJ0xvcmcvbXVsZS9hcGkvc2VjdXJpdHkvU2VjdXJpdHlDb250ZXh0O3hwAXB0ACQ4NTVjMTA1Yy0yNjE4LTExZTItOWU5Ny1mNWEwNzBkZTU1YTZwc3IAJWphdmEudXRpbC5Db2xsZWN0aW9ucyRTeW5jaHJvbml6ZWRNYXAbc/kJS0s5ewMAAkwAAW10AA9MamF2YS91dGlsL01hcDtMAAVtdXRleHQAEkxqYXZhL2xhbmcvT2JqZWN0O3hwc3IAJG9yZy5tdWxlLnV0aWwuQ2FzZUluc2Vuc2l0aXZlSGFzaE1hcJ3R2e9nRc4AAwAAeHB3DD9AAAAAAAAQAAAAAHhxAH4ACXh4 
    Server=Mule EE Core Extensions/3.3.0 
    Set-Cookie=[Lorg.apache.commons.httpclient.Cookie;@9f2588 
    Transfer-Encoding=chunked 
    http.headers={MULE_SESSION=rO0ABXNyACNvcmcubXVsZS5zZXNzaW9uLkRlZmF1bHRNdWxlU2Vzc2lvbi7rdtEW7GGKAwAEWgAFdmFsaWRMAA1mbG93Q29uc3RydWN0dAAmTG9yZy9tdWxlL2FwaS9jb25zdHJ1Y3QvRmxvd0NvbnN0cnVjdDtMAAJpZHQAEkxqYXZhL2xhbmcvU3RyaW5nO0wAD3NlY3VyaXR5Q29udGV4dHQAJ0xvcmcvbXVsZS9hcGkvc2VjdXJpdHkvU2VjdXJpdHlDb250ZXh0O3hwAXB0ACQ4NTVjMTA1Yy0yNjE4LTExZTItOWU5Ny1mNWEwNzBkZTU1YTZwc3IAJWphdmEudXRpbC5Db2xsZWN0aW9ucyRTeW5jaHJvbml6ZWRNYXAbc/kJS0s5ewMAAkwAAW10AA9MamF2YS91dGlsL01hcDtMAAVtdXRleHQAEkxqYXZhL2xhbmcvT2JqZWN0O3hwc3IAJG9yZy5tdWxlLnV0aWwuQ2FzZUluc2Vuc2l0aXZlSGFzaE1hcJ3R2e9nRc4AAwAAeHB3DD9AAAAAAAAQAAAAAHhxAH4ACXh4, Transfer-Encoding=chunked, Date=Sat, 03 Nov 2012 07:42:32 CDT, MULE_ENCODING=UTF-8, Keep-Alive=true, Set-Cookie=[Lorg.apache.commons.httpclient.Cookie;@9f2588, Connection=true, http.status=500, Content-Type=text/xml;charset=UTF-8, Server=Mule EE Core Extensions/3.3.0} 
    http.method=POST 
    http.query.params={} 
    http.query.string= 
    http.status=500 
    http.version=HTTP/1.1 
    OUTBOUND scoped properties: 
    MULE_ENCODING=UTF-8 
    MULE_SESSION=rO0ABXNyACNvcmcubXVsZS5zZXNzaW9uLkRlZmF1bHRNdWxlU2Vzc2lvbi7rdtEW7GGKAwAEWgAFdmFsaWRMAA1mbG93Q29uc3RydWN0dAAmTG9yZy9tdWxlL2FwaS9jb25zdHJ1Y3QvRmxvd0NvbnN0cnVjdDtMAAJpZHQAEkxqYXZhL2xhbmcvU3RyaW5nO0wAD3NlY3VyaXR5Q29udGV4dHQAJ0xvcmcvbXVsZS9hcGkvc2VjdXJpdHkvU2VjdXJpdHlDb250ZXh0O3hwAXB0ACQ4NTVjMTA1Yy0yNjE4LTExZTItOWU5Ny1mNWEwNzBkZTU1YTZwc3IAJWphdmEudXRpbC5Db2xsZWN0aW9ucyRTeW5jaHJvbml6ZWRNYXAbc/kJS0s5ewMAAkwAAW10AA9MamF2YS91dGlsL01hcDtMAAVtdXRleHQAEkxqYXZhL2xhbmcvT2JqZWN0O3hwc3IAJG9yZy5tdWxlLnV0aWwuQ2FzZUluc2Vuc2l0aXZlSGFzaE1hcJ3R2e9nRc4AAwAAeHB3DD9AAAAAAAAQAAAAAHhxAH4ACXh4 
    SESSION scoped properties: 
} 
org.mule.api.MessagingException: [Error: was expecting type: java.lang.Boolean; but found type: java.util.Map] 
[Near : {... eader:INBOUND:http.status=404 ....}] 
             ^
[Line: 1, Column: 110] (org.mule.api.expression.InvalidExpressionException). Message payload is of type: ReleasingInputStream 
    at org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:35) 
    at org.mule.execution.MessageProcessorNotificationExecutionInterceptor.execute(MessageProcessorNotificationExecutionInterceptor.java:43) 
    at org.mule.execution.MessageProcessorExecutionTemplate.execute(MessageProcessorExecutionTemplate.java:43) 
    at org.mule.processor.chain.DefaultMessageProcessorChain.doProcess(DefaultMessageProcessorChain.java:93) 
    at org.mule.processor.chain.AbstractMessageProcessorChain.process(AbstractMessageProcessorChain.java:66) 
    at org.mule.processor.chain.InterceptingChainLifecycleWrapper.doProcess(InterceptingChainLifecycleWrapper.java:57) 
    at org.mule.processor.chain.AbstractMessageProcessorChain.process(AbstractMessageProcessorChain.java:66) 
    at org.mule.processor.chain.InterceptingChainLifecycleWrapper.access$001(InterceptingChainLifecycleWrapper.java:29) 
    at org.mule.processor.chain.InterceptingChainLifecycleWrapper$1.process(InterceptingChainLifecycleWrapper.java:90) 
    at org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:27) 
    at org.mule.execution.MessageProcessorNotificationExecutionInterceptor.execute(MessageProcessorNotificationExecutionInterceptor.java:43) 
    at org.mule.execution.MessageProcessorExecutionTemplate.execute(MessageProcessorExecutionTemplate.java:43) 
    at org.mule.processor.chain.InterceptingChainLifecycleWrapper.process(InterceptingChainLifecycleWrapper.java:85) 
    at org.mule.exception.TemplateMessagingExceptionStrategy.route(TemplateMessagingExceptionStrategy.java:136) 
    at org.mule.exception.TemplateMessagingExceptionStrategy.handleException(TemplateMessagingExceptionStrategy.java:46) 
    at org.mule.exception.ChoiceMessagingExceptionStrategy.handleException(ChoiceMessagingExceptionStrategy.java:44) 
    at org.mule.execution.HandleExceptionInterceptor.execute(HandleExceptionInterceptor.java:45) 
    at org.mule.execution.HandleExceptionInterceptor.execute(HandleExceptionInterceptor.java:18) 
    at org.mule.execution.BeginAndResolveTransactionInterceptor.execute(BeginAndResolveTransactionInterceptor.java:58) 
    at org.mule.execution.ResolvePreviousTransactionInterceptor.execute(ResolvePreviousTransactionInterceptor.java:48) 
    at org.mule.execution.SuspendXaTransactionInterceptor.execute(SuspendXaTransactionInterceptor.java:54) 
    at org.mule.execution.ValidateTransactionalStateInterceptor.execute(ValidateTransactionalStateInterceptor.java:44) 
    at org.mule.execution.IsolateCurrentTransactionInterceptor.execute(IsolateCurrentTransactionInterceptor.java:44) 
    at org.mule.execution.ExternalTransactionInterceptor.execute(ExternalTransactionInterceptor.java:52) 
    at org.mule.execution.RethrowExceptionInterceptor.execute(RethrowExceptionInterceptor.java:32) 
    at org.mule.execution.RethrowExceptionInterceptor.execute(RethrowExceptionInterceptor.java:17) 
    at org.mule.execution.TransactionalErrorHandlingExecutionTemplate.execute(TransactionalErrorHandlingExecutionTemplate.java:113) 
    at org.mule.execution.TransactionalErrorHandlingExecutionTemplate.execute(TransactionalErrorHandlingExecutionTemplate.java:34) 
    at org.mule.transport.http.HttpMessageReceiver$HttpWorker.doRequest(HttpMessageReceiver.java:305) 
    at org.mule.transport.http.HttpMessageReceiver$HttpWorker.processRequest(HttpMessageReceiver.java:251) 
    at org.mule.transport.http.HttpMessageReceiver$HttpWorker.run(HttpMessageReceiver.java:163) 
    at org.mule.work.WorkerContext.run(WorkerContext.java:311) 
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) 
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) 
    at java.lang.Thread.run(Thread.java:662) 
Caused by: org.mule.api.expression.InvalidExpressionException: [Error: was expecting type: java.lang.Boolean; but found type: java.util.Map] 
[Near : {... eader:INBOUND:http.status=404 ....}] 
             ^
[Line: 1, Column: 110] 
    at org.mule.el.mvel.MVELExpressionLanguage.validate(MVELExpressionLanguage.java:244) 
    at org.mule.el.mvel.MVELExpressionLanguage.evaluateInternal(MVELExpressionLanguage.java:195) 
    at org.mule.el.mvel.MVELExpressionLanguage.evaluate(MVELExpressionLanguage.java:169) 
    at org.mule.expression.DefaultExpressionManager.evaluate(DefaultExpressionManager.java:234) 
    at org.mule.expression.DefaultExpressionManager.evaluateBoolean(DefaultExpressionManager.java:361) 
    at org.mule.routing.filters.ExpressionFilter.accept(ExpressionFilter.java:127) 
    at org.mule.routing.ChoiceRouter.selectProcessors(ChoiceRouter.java:35) 
    at org.mule.routing.AbstractSelectiveRouter.process(AbstractSelectiveRouter.java:194) 
    at org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:27) 
    ... 34 more 

有没有实现骡这种类型的逻辑方式?

问题是你在混合表达式求值器。你当条款应如下所示:

<catch-exception-strategy when="#[exception.causedBy(org.mule.api.routing.filter.FilterUnacceptedException) and message.inboundProperties['http.status']=404 ]" doc:name="Catch Exception Strategy"> 

在这里你可以找到文档中关于MEL