Spring integration spring轮询器的动态延迟配置
动态轮询 我正在使用集成中的轮询器组件轮询s3中的文件。固定延迟为15分钟,最大消息速率为1。我这样做的原因是xd中的下游消息由于我使用http而阻塞。现在这是用于100k记录文件的文件,但当文件大小很小时,我仍然等待15分钟,尽管我可以处理得很快。现在有什么问题吗根据文件大小动态设置延迟的方法。因为我们不知道哪些文件将被轮询也知道它?根据文件大小,我将拾取或记录数,我们可以动态更改固定延迟或固定速率吗Spring integration spring轮询器的动态延迟配置,spring-integration,spring-xd,Spring Integration,Spring Xd,动态轮询 我正在使用集成中的轮询器组件轮询s3中的文件。固定延迟为15分钟,最大消息速率为1。我这样做的原因是xd中的下游消息由于我使用http而阻塞。现在这是用于100k记录文件的文件,但当文件大小很小时,我仍然等待15分钟,尽管我可以处理得很快。现在有什么问题吗根据文件大小动态设置延迟的方法。因为我们不知道哪些文件将被轮询也知道它?根据文件大小,我将拾取或记录数,我们可以动态更改固定延迟或固定速率吗 <int:poller fixed-delay="${fixedDelay}" def
<int:poller fixed-delay="${fixedDelay}" default="true" max-messages-per-poll="${maxMessageRate}">
<int:advice-chain>
<ref bean="pollAdvise"/>
</int:advice-chain>
</int:poller>
<bean id="pollAdvise" class="org.springframework.integration.scheduling.PollSkipAdvice">
<constructor-arg ref="healthCheckStrategy"/>
</bean>
<bean id="healthCheckStrategy" class="test.ServiceHealthCheckPollSkipStrategy">
<property name="url" value="${url}"/>
<property name="doHealthCheck" value="${doHealthCheck}"/>
</bean>
<bean id="credentials" class="org.springframework.integration.aws.core.BasicAWSCredentials">
<property name="accessKey" value="${accessKey}"/>
<property name="secretKey" value="${secretKey}"/>
</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="${fileNameWildcard}"
remote-directory="${remoteDirectory}"
channel="splitChannel"
local-directory="${localDirectory}"
accept-sub-folders="false"
delete-source-files="true"
archive-bucket="${archiveBucket}"
archive-directory="${archiveDirectory}">
</int-aws:s3-inbound-channel-adapter>
<int-file:splitter id="s3splitter" input-channel="splitChannel" output-channel="bridge" markers="false" charset="UTF-8">
<int-file:request-handler-advice-chain>
<bean class="org.springframework.integration.handler.advice.ExpressionEvaluatingRequestHandlerAdvice">
<property name="onSuccessExpression" value="payload.delete()"/>
</bean>
</int-file:request-handler-advice-chain>
</int-file:splitter>
从Spring Integration 4.2开始,
AbstractMessageSourceAdvice
已经:
此方法在receive()方法之后调用;同样,您可以重新配置源代码,或者根据结果采取任何操作(如果源代码没有创建消息,则结果可以为null)。您甚至可以返回不同的消息
从4.3版开始,我们介绍了CompoundTriggerAdvice
:
您可以根据负载大小将其用于您的用例。假设有3个文件a.file 100 mb b.file 1 mb和c.file 10 mb。我认为轮询器会随机抽取它?我希望a.file具有10分钟的固定延迟文件b 1分钟和文件c 5分钟m-m-m。没关系。您想更改当前邮件的下一次轮询时间。您可以在
AbstractMessageSourceAdvice.afterReceive()
impl中执行的所有操作,并使用DynamicPeriodicTrigger
根据文件大小更改其期间。谢谢您的尝试