簡體   English   中英

在XD中處理文件流之前的運行狀況檢查

[英]health check before processing file stream in xd

我正在從s3中提取文件,並使用spring xd處理它們。 我有一個處理器http客戶端組件,我在其中執行一些RESTful請求。現在這種方法的問題是,如果我的Web服務關閉了,文件會累積在Rabbit mq傳輸中。因此在從s3中提取單個文件之前,我想進行運行狀況檢查在我的休息服務上。如何解決此問題,我的配置文件如下所示。

<?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

從Spring Integration 4.1開始, 引入PollSkipAdvice

為您的<int-aws:s3-inbound-channel-adapter>實施自己的ServiceHealthCheckPollSkipStrategy並將其注入到<poller><advice-chain>中,您可以滿足要求!

僅有一個問題是您的s3-sourcehttp-client的目標服務相關http-client ...

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM