2015-12-28 34 views
1

我从s3拉取文件并使用spring xd处理它们。我有一个处理器的http客户端组件,我做了一些RESTful请求。现在这种方法的问题是,如果我的web服务是关闭文件获取在兔子mq传输积累。因此,在从s3拉个人文件之前我想做一个健康检查在我的休息服务。我可以如何解决这个我的配置文件看起来像这样。处理xd文件流之前的健康检查

<?xml version="1.0" encoding="UTF-8"?> 
    <beans xmlns="http://www.springframework.org/schema/beans" 
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
      xmlns:int="http://www.springframework.org/schema/integration" 
      xmlns:int-aws="http://www.springframework.org/schema/integration/aws" 
      xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd 
      http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration.xsd 
      http://www.springframework.org/schema/integration/aws http://www.springframework.org/schema/integration/aws/spring-integration-aws-1.0.xsd"> 

     <int:poller fixed-delay="${fixed-delay}" default="true"/> 

     <bean id="credentials" class="org.springframework.integration.aws.core.BasicAWSCredentials"> 
      <property name="accessKey" value="${accessKey}"/> 
      <property name="secretKey" value="${secretKey}"/> 
     </bean> 

     <bean 
       class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> 
      <property name="location"> 
       <value>dms-aws-s3-nonprod.properties</value> 
      </property> 
     </bean> 

     <bean id="clientConfiguration" class="com.amazonaws.ClientConfiguration"> 
      <property name="proxyHost" value="${proxyHost}"/> 
      <property name="proxyPort" value="${proxyPort}"/> 
      <property name="preemptiveBasicProxyAuth" value="false"/> 
     </bean> 
    <bean id="s3Operations" class="org.springframework.integration.aws.s3.core.CustomC1AmazonS3Operations"> 
     <constructor-arg index="0" ref="credentials"/> 
     <constructor-arg index="1" ref="clientConfiguration"/> 
     <property name="awsEndpoint" value="s3.amazonaws.com"/> 
     <property name="temporaryDirectory" value="${temporaryDirectory}"/> 
     <property name="awsSecurityKey" value="${awsSecurityKey}"/> 
    </bean> 



    <!-- aws-endpoint="https://s3.amazonaws.com" --> 
    <int-aws:s3-inbound-channel-adapter aws-endpoint="s3.amazonaws.com" 
             bucket="${bucket}" 
             s3-operations="s3Operations" 
             credentials-ref="credentials" 
             file-name-wildcard="${file-name-wildcard}" 
             remote-directory="${remote-directory}" 
             channel="splitChannel" 
             local-directory="${local-directory}" 
             accept-sub-folders="false" 
             delete-source-files="true" 
             archive-bucket="${archive-bucket}" 
             archive-directory="${archive-directory}"> 
    </int-aws:s3-inbound-channel-adapter> 

    int-file:splitter input-channel="splitChannel" output-channel="output" markers="true"/> 

    <int:channel id="output"/> 

我流界定及

xd-shell>stream create feedTest16 --definition "aws-s3-source |processor-http-client| log" --deploy 

回答

1

与Spring集成4.1开始,PollSkipAdvice一直introduced

实现自己ServiceHealthCheckPollSkipStrategy,并将它注入到<poller><advice-chain><int-aws:s3-inbound-channel-adapter>,你是好与要求!

只有一个问题是,您的s3-source与目标服务并列为http-client ...