Spring Integration重试建议配置



只是一个问题,

我想配置一个retryadvice.

这将工作吗?

IntegrationFlows.from("inputChannel")

.transform(theTranformer , "theTransfomerMethod" , e -> e.handleMessageAdvice(new RequestHandlerRetryAdvice()))

.channel("outputChannel").get();

致意。

它将工作,但只有对该handleMessageAdvice的JavaDocs进行注释:

/**
* Configure a list of {@link MethodInterceptor} objects to be applied, in nested order, to the
* endpoint's handler. The advice objects are applied to the {@code handleMessage()} method
* and therefore to the whole sub-flow afterwards.
* @param interceptors the advice chain.
* @return the endpoint spec.
* @since 5.3
*/
public S handleMessageAdvice(MethodInterceptor... interceptors) {

如果你只想重试你的theTransfomerMethod,那么考虑通过以下方式配置这个建议:

/**
* Configure a list of {@link Advice} objects to be applied, in nested order, to the
* endpoint's handler. The advice objects are applied only to the handler.
* @param advice the advice chain.
* @return the endpoint spec.
*/
public S advice(Advice... advice) {

你面临的问题是什么?

一些版主会关闭你的问题,因为它缺少StackOverflow的概念问题:https://stackoverflow.com/help/how-to-ask

最新更新