我最近一直在使用批处理处理器,并且在测试中它运行良好。
我已经将它添加到我们的主要项目流程中,但我遇到了一个奇怪的问题。
Batch 进程本身只包含一个 Logger,发送给它的有效负载是一个 LineIterator。
我遇到的问题是它抛出了 SerializationException。奇怪的是它第一次运行时会在运行时抛出异常。之后它不会编译,抛出相同的异常。
以下是构建失败时流程中的批处理和相关堆栈信息。完整的跟踪附在 Mule 论坛上的这篇文章中:https ://forums.mulesoft.com/questions/65671/batch-process-could-非反序列化-object.html
<batch:job name="revenue-batch-Flow" block-size="10">
<batch:process-records>
<batch:step name="Batch_Step" accept-expression="#[!org.apache.commons.lang.StringUtils.isBlank( payload )]">
<logger message="#[payload]" level="INFO" doc:name="Logger"/>
</batch:step>
</batch:process-records>
</batch:job>
Caused by: com.esotericsoftware.kryo.KryoException: java.lang.UnsupportedOperationException
Serialization trace:
value (org.mule.transformer.types.TypedValue)
properties (org.mule.session.DefaultMuleSession)
session (org.mule.DefaultMuleEvent)
muleEvent (com.mulesoft.module.batch.DefaultBatchJobInstance)
关于导致这种奇怪行为的任何想法?
更新
只是为了添加一点上下文。我正在尝试遍历从 SFTP 读取的文件中的行。
该端点本身是在 Java 组件的流程中创建的:
@Override
public Object onCall(MuleEventContext muleEventContext) throws Exception {
String sftpUri = muleEventContext.getMessage().getProperty( "sesSftpUri", PropertyScope.SESSION);
EndpointBuilder endpointBuilder = muleEventContext.getMuleContext().getEndpointFactory().getEndpointBuilder( sftpUri );
endpointBuilder.addMessageProcessor(new MessageFilter(new FilenameWildcardFilter(muleEventContext.getMessage().getProperty( "sesFileName", PropertyScope.SESSION)) ));
InboundEndpoint inboundEndpoint = endpointBuilder.buildInboundEndpoint();
MuleMessage muleMessage = inboundEndpoint.request(30000L);
return muleMessage;
}
我刚刚检查过,我可以在本地批处理同一个文件,所以这是这个端点或其配置的问题。我可以将此端点配置为将文件放在临时目录中并从那里读取吗?