【问题标题】:How to integrate legacy executables into Spring Integration application?如何将遗留可执行文件集成到 Spring Integration 应用程序中?
【发布时间】:2016-02-12 15:30:32
【问题描述】:

我有一些 C 中的遗留程序,它们基于输入文件工作,结果转到输出文件。这两个文件都在程序参数中指定。所以调用如下所示:

prj.exe  a.dat a.out

根据 Artem Bilan 的建议,我使用以下 Spring 配置文件创建了项目。它在调用可执行文件方面起作用!但是,我仍然有出站渠道的问题。首先,它不包含任何内容,并且我收到错误“不支持的消息有效负载类型”。其次,更重要的是,我需要通过Java程序处理输出文件a.out。组织此工作流程的最佳方式是什么?是否可以将这种情况下无用的 inbound-channel-adapter 替换为有用的东西?

<int-file:inbound-channel-adapter id="producer-file-adapter"
    channel="inboundChannel" directory="file:/Users/anarinsky/springint/chem"
    prevent-duplicates="true">
    <int:poller fixed-rate="5000" />
</int-file:inbound-channel-adapter>

<int:channel id="inboundChannel" />
<int:channel id="outboundChannel" />
<int:service-activator input-channel="inboundChannel"  output-channel="outboundChannel"
expression="new ProcessBuilder('/Users/anarinsky/springint/chem/prj', '/Users/anarinsky/springint/chem/a.dat', '/Users/anarinsky/springint/chem/a.out').start()">
</int:service-activator>

<int-file:outbound-channel-adapter
    channel="outboundChannel" id="consumer-file-adapter"
    directory="file:/Users/anarinsky/springint/chem"/>

【问题讨论】:

    标签: spring spring-integration


    【解决方案1】:

    类似这样的:

    <int:service-activator expression="new ProcessBuilder('prj.exe', 'a.dat', 'a.out').start()"/>
    

    ?

    【讨论】:

    • 有效!只是几个额外的问题,请参阅说明。
    猜你喜欢
    • 2020-02-20
    • 1970-01-01
    • 2019-07-05
    • 2014-12-09
    • 1970-01-01
    • 2012-01-12
    • 2016-06-01
    • 2012-04-18
    • 1970-01-01
    相关资源
    最近更新 更多