我们有一个Mule项目,其工作原理如下:
我们读取数据库中的Id值,我们用它来从数据库中读取多条记录,然后使用'foreach'逐个处理。
一切正常,但有些记录在到达新流程时会出现以下错误。
INFO 2014-07-11 10:00:45,584 [[tcol_act_es_insert] .adapter_act_es_insert.stage1.45] org.mule.api.processor.LoggerMessageProcessor: - TRACE Id Lote en proceso:44197277 INFO 2014-07-11 10:00:45,584 [[tcol_act_es_insert] .adapter_act_es_insert.stage1.48] org.mule.api.processor.LoggerMessageProcessor: - TRACE Id Lote en proceso:44197278 INFO 2014-07-11 10:00:45,584 [[tcol_act_es_insert] .adapter_act_es_insert.stage1.47] org.mule.api.processor.LoggerMessageProcessor: - TRACE Id Lote en proceso:44197279 WARN 2014-07-11 10:00:45,585 [[tcol_act_es_insert] .adapter_act_es_insert.stage1.01] org.mule.util.queue.TransactionalQueueSession:无法反序列化消息 java.lang.reflect.InvocationTargetException at sun.reflect.GeneratedMethodAccessor18.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 在java.lang.reflect.Method.invoke(Method.java:616) at org.mule.util.store.DeserializationPostInitialisable $ Implementation $ 1.run(DeserializationPostInitialisable.java:48) at java.security.AccessController.doPrivileged(Native Method) at org.mule.util.store.DeserializationPostInitialisable $ Implementation.init(DeserializationPostInitialisable.java:40) at org.mule.util.queue.TransactionalQueueSession $ QueueImpl.postProcessIfNeeded(TransactionalQueueSession.java:242) at org.mule.util.queue.TransactionalQueueSession $ QueueImpl.poll(TransactionalQueueSession.java:161) at org.mule.processor.SedaStageInterceptingMessageProcessor.dequeue(SedaStageInterceptingMessageProcessor.java:130) 在org.mule.processor.SedaStageInterceptingMessageProcessor.run(SedaStageInterceptingMessageProcessor.java:205) 在org.mule.work.WorkerContext.run(WorkerContext.java:286) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) at java.util.concurrent.ThreadPoolExecutor $ Worker.run(ThreadPoolExecutor.java:603) 在java.lang.Thread.run(Thread.java:679) 引起:java.util.ConcurrentModificationException at org.apache.commons.collections.map.AbstractHashedMap $ HashIterator.nextEntry(AbstractHashedMap.java:1113) at org.apache.commons.collections.map.AbstractHashedMap $ KeySetIterator.next(AbstractHashedMap.java:938) 在org.mule.DefaultMuleEvent.setMessage(DefaultMuleEvent.java:968) 在org.mule.DefaultMuleEvent.initAfterDeserialisation(DefaultMuleEvent.java:732) ......还有14个
然后我选择导致错误的记录,如果第二次处理此记录将被正确处理。
这是我的代码骡子......
<flow name="tcol_act_es_insert" doc:name="tcol_act_es_insert" initialState="started">
<jdbc-ee:inbound-endpoint queryKey="select_counter_id" queryTimeout="10" pollingFrequency="30000" connector-ref="Dabase_otros_dev_insert" doc:name="InputDatabase_Counter">
<jdbc-ee:query key="select_counter_id" value="select * from todocoleccion.dbo.config where field='act_es_last_id'"></jdbc-ee:query>
</jdbc-ee:inbound-endpoint>
<set-variable variableName="InputRowsetCounter" value="#[payload]" doc:name="InputRowsetCounter"></set-variable>
<jdbc-ee:outbound-endpoint exchange-pattern="request-response" queryKey="ReloadLotes" queryTimeout="-1" connector-ref="Database_dev_insert" doc:name="ReloadLotes">
<jdbc-ee:query key="ReloadLotes" value="select TOP 50 CONVERT(varchar(50), l.Ultima_Modificacion, 127)+'Z' as ultima_modificacion, l.Id_Lote as id_lote,
...
where Id_Lote>#[InputRowsetCounter.value] and l.Id_Seccion=s.Id_Seccion order by id_lote;"></jdbc-ee:query>
</jdbc-ee:outbound-endpoint>
<set-variable variableName="InputRowsetLotes" value="#[payload]" doc:name="InputRowsetLotes"></set-variable>
<expression-filter expression="#[!payload.isEmpty()]" doc:name="sinLotes"></expression-filter>
<logger level="INFO" doc:name="Logger"></logger>
<jdbc-ee:outbound-endpoint exchange-pattern="request-response" queryKey="update_counter_config" queryTimeout="-1" connector-ref="Database_todocoleccion_dev_insert" doc:name="Update_Counter">
<jdbc-ee:query key="update_counter_config" value="update todocoleccion.dbo.config set value=#[InputRowsetLotes[InputRowsetLotes.size()-1].id_lote] where field='act_es_last_id'"></jdbc-ee:query>
</jdbc-ee:outbound-endpoint>
<foreach collection="InputRowsetLotes" counterVariableName="counterLotes" rootMessageVariableName="rootMessageLotes" doc:name="For Each Lote">
<flow-ref name="adapter_act_es_insert" doc:name="Flow Reference Dispatcher"></flow-ref>
</foreach>
<catch-exception-strategy doc:name="Catch Exception Strategy">
<flow-ref name="error_handler_act_es_insert" doc:name="Ref Error Handler"></flow-ref>
</catch-exception-strategy>
</flow>
<flow name="adapter_act_es_insert" doc:name="adapter_act_es_insert">
<choice doc:name="Choice">
<when expression="!payload.isEmpty()">
<logger message="--TRACE Id Lote en proceso: #[payload.id_lote]" level="INFO" doc:name="Logger"></logger>
我们在Ubuntu Server 64位上使用mule-standalone-3.5.0-M4.tar.gz。
提前谢谢你。