直到成功的组件轮询HTTP端点直到满足条件 [英] UntilSuccessful component to poll http endpoint till condition is met
问题描述
轮询http端点,接收JSON响应,我希望一直轮询直到满足条件.
我已经尝试过<until-successful failureExpression="#[json:status != 'COMPLETED']" maxRetries="5" secondsBetweenRetries="10" synchronous="true">
,但这给出了异常.
Polling http endpoint, receiving JSON response, I wish to keep polling till a condition is met.
I have tried <until-successful failureExpression="#[json:status != 'COMPLETED']" maxRetries="5" secondsBetweenRetries="10" synchronous="true">
but this is giving exception.
请让我知道我的方案是否还有另一种方法
Please also let me know if there is another method for my scenario
推荐答案
将计算值分配给流量变量,并提供评估相应流量变量的条件.
assign the compute value to flow variable and provide condition evaluting the corresponding flow variable.
<until-successful failureExpression="#[flowVars['testRetryCondition'] != 'COMPLETED']" maxRetries="5" secondsBetweenRetries="10" synchronous="true">
<processor-chain doc:name="Processor Chain">
<http:........./>
<set-variable variableName="testRetryCondition" value="#[json:status != 'COMPLETED']" doc:name="set-invocation-status"/>
</processor-chain>
</until-successful>
<until-successful failureExpression="#[flowVars['testRetryCondition'] != 'COMPLETED']" maxRetries="5" secondsBetweenRetries="10" synchronous="true">
<processor-chain doc:name="Processor Chain">
<http:........./>
<set-variable variableName="testRetryCondition" value="#[json:status != 'COMPLETED']" doc:name="set-invocation-status"/>
</processor-chain>
</until-successful>
这篇关于直到成功的组件轮询HTTP端点直到满足条件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!