分区步骤保持启动状态,具有多个节点

时间:2017-04-14 14:14:23

标签: spring spring-batch partitioning

Spring集成在单个节点集群上运行良好。但是,当我们在多个节点上部署应用程序时,partitionStep没有完成并永远保持在STARTED状态。似乎PartitionStep在receive方法中等待,并且从不标记步骤COMPLETED。以下是我正在使用的配置。有没有办法在主节点上启动聚合器?

主配置:

<bean id="jndiTemplate" class="org.springframework.jndi.JndiTemplate">
    <property name="environment">
        <props>
            <prop key="java.naming.factory.initial">weblogic.jndi.WLInitialContextFactory</prop>
            <prop key="java.naming.provider.url">t3://localhost:7001</prop>
        </props>
    </property>
</bean>

<bean id="connectionFactory" class="org.springframework.jndi.JndiObjectFactoryBean">
    <property name="jndiTemplate" ref="jndiTemplate" />
    <property name="jndiName" value="jmsConnectionFactory" />
</bean>

<int:channel id="requestsChannel" />

<bean id="reqQueue" class="org.springframework.jndi.JndiObjectFactoryBean"
    lazy-init="true" scope="prototype">
    <property name="jndiTemplate">
        <ref bean="jndiTemplate" />
    </property>
    <property name="jndiName">
        <value>masterRequestQueue</value>
    </property>
</bean>

<int-jms:outbound-channel-adapter
    connection-factory="connectionFactory" channel="requestsChannel" destination="reqQueue" />

<int:channel id="replyChannel" />

<bean id="replyQueue" class="org.springframework.jndi.JndiObjectFactoryBean"
    lazy-init="true" scope="prototype">
    <property name="jndiTemplate">
        <ref bean="jndiTemplate" />
    </property>
    <property name="jndiName">
        <value>masterReplyQueue</value>
    </property>
</bean>

<int-jms:message-driven-channel-adapter connection-factory="connectionFactory" destination="replyQueue" channel="replyChannel" auto-startup="false"/>

<int:channel id="aggregatedReplyChannel">
    <int:queue />
</int:channel>

<int:aggregator ref="partitionHandler" 
        input-channel="replyChannel" output-channel="aggregatedReplyChannel" />

从属配置:

<bean id="jndiTemplate" class="org.springframework.jndi.JndiTemplate">
    <property name="environment">
        <props>
            <prop key="java.naming.factory.initial">weblogic.jndi.WLInitialContextFactory</prop>
            <prop key="java.naming.provider.url">t3://localhost:7001</prop>
        </props>
    </property>
</bean>

<bean id="connectionFactory" class="org.springframework.jndi.JndiObjectFactoryBean">
    <property name="jndiTemplate" ref="jndiTemplate" />
    <property name="jndiName" value="jmsConnectionFactory" />
</bean>

<task:executor id="taskExecutor" pool-size="10" />

<int:channel id="requestsChannel">
    <int:dispatcher task-executor="taskExecutor" />
</int:channel>

<bean id="reqQueue" class="org.springframework.jndi.JndiObjectFactoryBean"
    lazy-init="true" scope="prototype">
    <property name="jndiTemplate">
        <ref bean="jndiTemplate" />
    </property>
    <property name="jndiName">
        <value>masterRequestQueue</value>
    </property>
</bean>

<int-jms:message-driven-channel-adapter connection-factory="connectionFactory" destination="reqQueue" channel="requestsChannel" />

<int:channel id="replyChannel" />

<bean id="replyQueue" class="org.springframework.jndi.JndiObjectFactoryBean"
    lazy-init="true" scope="prototype">
    <property name="jndiTemplate">
        <ref bean="jndiTemplate" />
    </property>
    <property name="jndiName">
        <value>masterReplyQueue</value>
    </property>
</bean>

<int-jms:outbound-channel-adapter
    connection-factory="connectionFactory" destination="replyQueue" channel="replyChannel" />

<int:service-activator input-channel="requestsChannel"
    output-channel="replyChannel" ref="stepExecutionRequestHandler" />

Spring批处理版3.0.3 Spring核心版本4.0.5 Spring集成版本4.0.1

0 个答案:

没有答案