Я хотел бы дополнить текущее сообщение двумя переменными, LAST_POLL_START и LAST_POLL_END.Затем эти переменные будут использоваться для создания другого запроса jdbc.
Однако я не могу понять, как мне использовать обогащатель.Код, который я пробовал, приведен ниже, и он основан на коде, найденном здесь и в блоге Mule .На мой взгляд, это должно работать.Я использую mule-3.2.0, и запрос jdbc работает и возвращает правильные значения.
<flow name="MasterFlow" processingStrategy="synchronous">
<quartz:inbound-endpoint jobName="cronJobPoolTime" cronExpression="0 0/1 * * * ?">
<quartz:endpoint-polling-job>
<quartz:job-endpoint ref="jdbc_quartzDummy"/>
</quartz:endpoint-polling-job>
</quartz:inbound-endpoint>
<flow-ref name="GetPollingTimes" />
<!-- Do other things -->
</flow>
<!-- Below is needed when using Quartz trigger -->
<jdbc:endpoint name="jdbc_quartzDummy" connector-ref="tabuConnector" queryKey="quartzDummy" />
<flow name="GetPollingTimes">
<enricher>
<jdbc:outbound-endpoint queryKey="getPollTimes" exchange-pattern="request-response" />
<enrich target="#[variable:last_poll_start]" source="#[map-payload:LAST_POLL_START]"/>
<enrich target="#[variable:last_poll_end]" source="#[map-payload:LAST_POLL_END]"/>
</enricher>
<logger level="INFO" message="last_poll_start = #[variable:last_poll_start]" />
</flow>
Сообщение об ошибке:
WARN 2011-12-27 15:38:00,831 [scheduler-ESB_Worker-1] org.mule.DefaultMuleMessage: setProperty(key, value) called with null value; removing key: last_poll_start; please report the following stack trace to dev@mule.codehaus.org
java.lang.Throwable
at org.mule.DefaultMuleMessage.setProperty(DefaultMuleMessage.java:456)
at org.mule.expression.VariableExpressionEnricher.enrich(VariableExpressionEnricher.java:24)
at org.mule.expression.DefaultExpressionManager.enrich(DefaultExpressionManager.java:248)
at org.mule.expression.DefaultExpressionManager.enrich(DefaultExpressionManager.java:237)
at org.mule.enricher.MessageEnricher.enrich(MessageEnricher.java:69)
at org.mule.enricher.MessageEnricher.process(MessageEnricher.java:43)
at org.mule.processor.chain.DefaultMessageProcessorChain.doProcess(DefaultMessageProcessorChain.java:99)
at org.mule.processor.chain.AbstractMessageProcessorChain.process(AbstractMessageProcessorChain.java:64)
at org.mule.processor.AbstractInterceptingMessageProcessorBase.processNext(AbstractInterceptingMessageProcessorBase.java:105)
at org.mule.processor.AsyncInterceptingMessageProcessor.process(AsyncInterceptingMessageProcessor.java:90)
at org.mule.processor.chain.DefaultMessageProcessorChain.doProcess(DefaultMessageProcessorChain.java:99)
at org.mule.processor.chain.AbstractMessageProcessorChain.process(AbstractMessageProcessorChain.java:64)
at org.mule.processor.AbstractInterceptingMessageProcessorBase.processNext(AbstractInterceptingMessageProcessorBase.java:105)
at org.mule.interceptor.AbstractEnvelopeInterceptor.process(AbstractEnvelopeInterceptor.java:55)
at org.mule.processor.AbstractInterceptingMessageProcessorBase.processNext(AbstractInterceptingMessageProcessorBase.java:105)
at org.mule.processor.AbstractFilteringMessageProcessor.process(AbstractFilteringMessageProcessor.java:41)
at org.mule.processor.chain.DefaultMessageProcessorChain.doProcess(DefaultMessageProcessorChain.java:99)
at org.mule.processor.chain.AbstractMessageProcessorChain.process(AbstractMessageProcessorChain.java:64)
at org.mule.processor.chain.InterceptingChainLifecycleWrapper.doProcess(InterceptingChainLifecycleWrapper.java:56)
at org.mule.processor.chain.AbstractMessageProcessorChain.process(AbstractMessageProcessorChain.java:64)
at org.mule.processor.chain.InterceptingChainLifecycleWrapper.process(InterceptingChainLifecycleWrapper.java:87)
at org.mule.construct.Flow.process(Flow.java:64)
at org.mule.config.spring.factories.FlowRefFactoryBean$1.process(FlowRefFactoryBean.java:44)
at org.mule.processor.chain.DefaultMessageProcessorChain.doProcess(DefaultMessageProcessorChain.java:99)
at org.mule.processor.chain.AbstractMessageProcessorChain.process(AbstractMessageProcessorChain.java:64)
at org.mule.processor.AbstractInterceptingMessageProcessorBase.processNext(AbstractInterceptingMessageProcessorBase.java:105)
at org.mule.interceptor.AbstractEnvelopeInterceptor.process(AbstractEnvelopeInterceptor.java:55)
at org.mule.processor.AbstractInterceptingMessageProcessorBase.processNext(AbstractInterceptingMessageProcessorBase.java:105)
at org.mule.processor.AbstractFilteringMessageProcessor.process(AbstractFilteringMessageProcessor.java:41)
at org.mule.processor.chain.DefaultMessageProcessorChain.doProcess(DefaultMessageProcessorChain.java:99)
at org.mule.processor.chain.AbstractMessageProcessorChain.process(AbstractMessageProcessorChain.java:64)
at org.mule.processor.chain.InterceptingChainLifecycleWrapper.doProcess(InterceptingChainLifecycleWrapper.java:56)
at org.mule.processor.chain.AbstractMessageProcessorChain.process(AbstractMessageProcessorChain.java:64)
at org.mule.processor.chain.InterceptingChainLifecycleWrapper.process(InterceptingChainLifecycleWrapper.java:87)
at org.mule.construct.AbstractPipeline$1.process(AbstractPipeline.java:138)
at org.mule.processor.chain.DefaultMessageProcessorChain.doProcess(DefaultMessageProcessorChain.java:99)
at org.mule.processor.chain.AbstractMessageProcessorChain.process(AbstractMessageProcessorChain.java:64)
at org.mule.processor.chain.InterceptingChainLifecycleWrapper.doProcess(InterceptingChainLifecycleWrapper.java:56)
at org.mule.processor.chain.AbstractMessageProcessorChain.process(AbstractMessageProcessorChain.java:64)
at org.mule.processor.chain.InterceptingChainLifecycleWrapper.process(InterceptingChainLifecycleWrapper.java:87)
at org.mule.processor.chain.DefaultMessageProcessorChain.doProcess(DefaultMessageProcessorChain.java:99)
at org.mule.processor.chain.AbstractMessageProcessorChain.process(AbstractMessageProcessorChain.java:64)
at org.mule.processor.chain.InterceptingChainLifecycleWrapper.doProcess(InterceptingChainLifecycleWrapper.java:56)
at org.mule.processor.chain.AbstractMessageProcessorChain.process(AbstractMessageProcessorChain.java:64)
at org.mule.processor.chain.InterceptingChainLifecycleWrapper.process(InterceptingChainLifecycleWrapper.java:87)
at org.mule.transport.AbstractMessageReceiver.routeMessage(AbstractMessageReceiver.java:190)
at org.mule.transport.AbstractMessageReceiver.routeMessage(AbstractMessageReceiver.java:163)
at org.mule.transport.AbstractMessageReceiver.routeMessage(AbstractMessageReceiver.java:150)
at org.mule.transport.quartz.jobs.EndpointPollingJob$1.doInTransaction(EndpointPollingJob.java:162)
at org.mule.transport.quartz.jobs.EndpointPollingJob$1.doInTransaction(EndpointPollingJob.java:125)
at org.mule.transaction.TransactionTemplate.execute(TransactionTemplate.java:45)
at org.mule.transport.quartz.jobs.EndpointPollingJob.doExecute(EndpointPollingJob.java:169)
at org.mule.transport.quartz.jobs.AbstractJob.execute(AbstractJob.java:36)
at org.quartz.core.JobRunShell.run(JobRunShell.java:202)
at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:534)
Изменение источника обогащения на #[полезная нагрузка]:
<enrich target="#[variable:last_poll_start]" source="#[payload]"/>
<logger level="INFO" message="last_poll_start = #[variable:last_poll_start]" />
Производит (из файла журнала):
org.mule.api.processor.LoggerMessageProcessor: last_poll_start = [{LAST_POLL_START=2011-12-21, LAST_POLL_END=2000-01-01}]