0
我正在嘗試在我的流程中使用表達式#[process:processName:valueToProcess]
。Mule:進程表達式求值程序
這是我的流程配置:
<flow name="exampleFlow">
<quartz:inbound-endpoint jobName="job1" cronExpression="0/5 * * * * ?" connector-ref="quartzConnector">
<quartz:event-generator-job>
<quartz:payload>foo</quartz:payload>
</quartz:event-generator-job>
</quartz:inbound-endpoint>
<logger message="#[process:test:#[payload]]" level="INFO"/>
</flow>
<sub-flow name="test" doc:name="test">
<component class="com.myComp.ComponentTest" doc:name="Java"/>
</sub-flow>
這是我的Java組件:
package com.myComp;
public class ComponentTest
{
public String test(String s)
{
return s + "bar";
}
}
時表達#[process:test:#[payload]]
評估問題來了。它會拋出以下異常:
java.lang.NullPointerException
at org.mule.component.AbstractComponent.invokeInternal(AbstractComponent.java:112)
at org.mule.component.AbstractComponent.process(AbstractComponent.java:156)
at org.mule.processor.chain.DefaultMessageProcessorChain.doProcess(DefaultMessageProcessorChain.java:99)
at org.mule.processor.chain.AbstractMessageProcessorChain.process(AbstractMessageProcessorChain.java:66)
at org.mule.processor.chain.InterceptingChainLifecycleWrapper.doProcess(InterceptingChainLifecycleWrapper.java:56)
at org.mule.processor.chain.AbstractMessageProcessorChain.process(AbstractMessageProcessorChain.java:66)
at org.mule.processor.chain.InterceptingChainLifecycleWrapper.process(InterceptingChainLifecycleWrapper.java:87)
at org.mule.api.processor.MessageProcessors$LifecyleAwareMessageProcessorWrapper.process(MessageProcessors.java:114)
at org.mule.expression.MessageProcessorExpressionEvaluator.evaluate(MessageProcessorExpressionEvaluator.java:87)
at org.mule.expression.DefaultExpressionManager.evaluate(DefaultExpressionManager.java:273)
at org.mule.expression.DefaultExpressionManager.evaluate(DefaultExpressionManager.java:209)
at org.mule.expression.DefaultExpressionManager$1.match(DefaultExpressionManager.java:399)
at org.mule.util.TemplateParser.parse(TemplateParser.java:156)
at org.mule.util.TemplateParser.parse(TemplateParser.java:133)
at org.mule.expression.DefaultExpressionManager.parse(DefaultExpressionManager.java:395)
at org.mule.expression.DefaultExpressionManager.parse(DefaultExpressionManager.java:379)
at org.mule.api.processor.LoggerMessageProcessor.log(LoggerMessageProcessor.java:89)
at org.mule.api.processor.LoggerMessageProcessor.process(LoggerMessageProcessor.java:71)
at org.mule.processor.chain.DefaultMessageProcessorChain.doProcess(DefaultMessageProcessorChain.java:99)
at org.mule.processor.chain.AbstractMessageProcessorChain.process(AbstractMessageProcessorChain.java:66)
at org.mule.processor.AbstractInterceptingMessageProcessorBase.processNext(AbstractInterceptingMessageProcessorBase.java:105)
at org.mule.interceptor.AbstractEnvelopeInterceptor.process(AbstractEnvelopeInterceptor.java:55)
at org.mule.processor.AsyncInterceptingMessageProcessor.processNextTimed(AsyncInterceptingMessageProcessor.java:111)
at org.mule.processor.AsyncInterceptingMessageProcessor$AsyncMessageProcessorWorker.doRun(AsyncInterceptingMessageProcessor.java:158)
at org.mule.work.AbstractMuleEventWork.run(AbstractMuleEventWork.java:43)
at org.mule.work.WorkerContext.run(WorkerContext.java:310)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
其他任何腳本組件都會發生同樣的情況。 我猜它與我的組件生命週期有關,但是我找不到一種方法來使它工作。 如果我用任何其他Mule處理器(例如記錄器,stringAppend)替換我的組件,它工作正常。
任何幫助將不勝感激!
謝謝您的回答大衛!不幸的是,如果我使用私人流程,結果不會反映在主要流程表達式評估中。任何其他處理器/組件都會發生同樣的情況。 – Daniel 2012-07-12 21:29:39
Darn,我用VM更換了入站的Quartz,以便於測試,並發現使用私有流解決了問題。讓我試着用Quartz端點來看看會發生什麼。我認爲這是一個不同的問題。 – 2012-07-12 21:41:58
發現問題並修改了我的答案。 – 2012-07-12 21:52:42