Spring集成不会执行第二个groovy脚本

时间:2015-10-06 01:20:57

标签: spring groovy batch-processing

我使用spring集成来执行包含在groovy脚本中的2个spring批处理可执行jar文件。如果spring集成配置为执行第一个groovy脚本,然后第二个它只执行第一个脚本而不执行第二个脚本。如果我在spring集成配置中将其反转,它会执行第二个groovy脚本并且不会先执行。我的集成配置如下

<int:logging-channel-adapter id="logger"  log-full-message="true"       level="INFO" logger-name="org.springframework"/>
<int:wire-tap channel="logger" />   
 <context:mbean-server />
 <int-jmx:mbean-export/>
<int-file:inbound-channel-adapter id="getFile" directory="file:${xmlFileInputDirectory}"
     prevent-duplicates="true" channel="channel1" filename-pattern="Data*">
    <int:poller id="poller" max-messages-per-poll="1" fixed-rate="5000">            
    </int:poller>

</int-file:inbound-channel-adapter>

<int:channel id="channel1">
    <int:interceptors>
         <int:wire-tap channel="logger"/>
    </int:interceptors>
</int:channel>

<int:channel id="channe2">
<int:interceptors>
         <int:wire-tap channel="logger"/>
    </int:interceptors>     
</int:channel>

<int:service-activator input-channel="channel1" output-channel="channe2">                 
    <int-groovy:script>
        <![CDATA[
            def proc = "java -Dfile.encoding=utf8 -Dlogging.config=log4j2.xml -jar one.jar".execute();
            proc.waitForProcessOutput(System.out, System.err);
        ]]>
    </int-groovy:script>        
</int:service-activator>

<int:service-activator input-channel="channe2">                 
    <int-groovy:script>
        <![CDATA[
            def proc = "java -Dfile.encoding=utf8 -Dlogging.config=log4j2.xml -jar two.jar --data.dictionary.path=data.csv".execute();
            proc.waitForProcessOutput(System.out, System.err);
        ]]>
    </int-groovy:script>        
</int:service-activator>          


<int:message-history/>  


<bean id="mainClass"
    class="com.company.Main" /> 

启动第一批作业的主要课程如下所示:

    public final class Main {   

private Main() { }


public static void main(final String... args) {

    final AbstractApplicationContext context =
    new ClassPathXmlApplicationContext("classpath:META-INF/int_file");  
    context.start();


}

}

我的第一批作业主要课程如下:

    public class Application {

public static void main(String[] args)
        throws ... {        

    SpringApplication.run(Application.class, args);
    System.exit(0);
}

}

0 个答案:

没有答案