总之,我有一个要求,在使用Spring批处理时,我确实生成了最终结果文件。生成文件后,我需要使用SFTP将它们传输到另一个服务器。现在我把它们看成是两个独立的程序。有没有办法让我把这两个结合起来?我想知道我是否可以使用Spring批处理生成文件,然后立即将文件传输到生成文件的同一程序中的另一个服务器。
我是一个新的Spring批次,所以寻找可能的方法。
不确定为什么会出现连接超时错误。
XML配置为
xsi:schemaLocation=
http://www.springframework.org/schema/integration
http://www.springframework.org/schema/integration/spring-integration-3.0.xsd
http://www.springframework.org/schema/integration/sftp
http://www.springframework.org/schema/integration/sftp/spring-integration-sftp-3.0.xsd">
<bean id="cachingSessionFactory"
class="org.springframework.integration.file.remote.session.CachingSessionFactory">
<constructor-arg ref="sftpSessionFactory" />
<property name="sessionCacheSize" value="10" />
<property name="sessionWaitTimeout" value="1000" />
</bean>
<bean id="sftpSessionFactory"
class="org.springframework.integration.sftp.session.DefaultSftpSessionFactory">
<property name="host" value="server" />
<property name="user" value="userid" />
<property name="password" value="pwd" />
<property name="port" value="22" />
</bean>
<int:channel id="outputChannel" />
<int:channel id="inputChannel" />
<int-sftp:outbound-channel-adapter
id="sftpOutboundAdapter" session-factory="sftpSessionFactory" channel="inputChannel"
charset="UTF-8" remote-file-separator="/"
remote-directory="/tmp/"
/>
<bean id="fileNameGenerator"
class="org.springframework.integration.file.DefaultFileNameGenerator" />
<bean id="sftpJobTasklet" class="com.sftpexample.util.SftpTasklet">
<property name="fileName"
value="C:\sftpexample\test.txt" />
<property name="sftpChannel" ref="inputChannel" />
</bean>
上述问题已经解决。我必须添加spring-integration-file和spring-integration-sftp jar,它解决了这个问题
我有一个包含多个json文件的zip文件。我已解压缩它们,然后使用以下代码从json获取POJO对象: 但我需要使用spring批处理逐个处理这些json文件。有人能帮助我如何在spring批处理中实现这一点吗?我想使用1000块来读取json文件。我的json对象非常复杂。例子:
需要读取spring批处理中的文件,对其进行处理并将其作为一个提要保存。一个提要包含50%的信息。当我必须持久化提要的最终结果时,我需要使用公共字段将它们组合起来,并像一个项目一样持久化。请参见下面的示例。 我需要保留的最终信息如下: 请建议我如何在我的Spring批工作中实现这一点。 谢谢
主要内容:重定向输出(Stdout和Stderr),抑制程序输出有三个键盘输入的通用“文件”,在屏幕上打印文本和在屏幕上打印错误。 标准输入文件(stdin)包含程序/脚本的输入。 标准输出(Standard Out)文件(stdout)被用来写输出以显示在屏幕上。 最后一种叫作的“标准错误”文件包含用于显示在屏幕上的任何错误消息。 这三个标准文件中的每一个(也称为标准流)分别使用数字,和进行引用。Stdin是文件,stdout是文件,stderr是文件。 重
我有以下工作要处理在一定的时间间隔或特别的基础上。 作业中的步骤如下: 我也想要用户界面,在那里我可以触发一个特别的基础上的工作,而且我应该能够提供参数从用户界面。 我想用Spring batch来完成这个任务,但它更多的是用于读->处理->写之类的工作。这里,在第一步中,我正在生成由第二步读取的数据。我不确定我是否还可以使用Spring batch来实现这个,或者有更好的方法来实现这个。
我正在尝试创建一个应用程序,该应用程序使用spring-batch-excel扩展名来读取用户通过web界面上传的Excel文件,以便解析Excel文件中的地址。 当代码运行时,没有错误,但我得到的只是我日志中的以下内容。即使我的处理器和Writer中都有log/syso(它们从未被调用过,我所能想象的是它没有正确读取文件,也没有返回要处理/写入的数据)。是的,这个文件有数据,实际上有几千条记录。
主要内容:创建批处理文件,保存批处理文件,执行批处理文件,修改批处理文件在本章中,我们将学习如何创建,保存,执行和修改批处理文件。 创建批处理文件 批处理文件通常在记事本中创建。 因此,最简单的方法是打开记事本并输入脚本所需的命令。 对于这个练习,打开记事本并输入以下语句。 保存批处理文件 在创建批处理文件后,下一步是保存批处理文件。 批处理文件的扩展名为或。 命名批处理文件时需要注意的一些常规规则 - 在命名批处理文件时避免使用空格,有时会在从其他脚本中调用时产生问