【问题标题】:Spring Integration retry advice configurationSpring Integration 重试建议配置
【发布时间】:2021-08-12 20:08:28
【问题描述】:

只是一个问题,

我想配置重试建议。

这行得通吗?

IntegrationFlows.from("inputChannel")

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

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

问候。

【问题讨论】:

    标签: spring spring-integration spring-integration-dsl


    【解决方案1】:

    它会起作用,但只有在 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

    【讨论】:

    • 我完全没有问题,我在弹性上刷新索引(我有一个集成流程来索引一些文档),然后日志上出现了一些失败,我想知道我是否可以重试在变压器上使用此配置的策略。
    • 但是更好地考虑它不会起作用需要对在集成结束时发送的文档进行完整检查,我猜如果 http 方法失败,spring-data-elastic 不会抛出异常。
    • 抱歉,无法帮助spring-data-elastic。也许,如果你分享一些简单的项目来玩,那么我会调试它看看会发生什么。
    猜你喜欢
    • 1970-01-01
    • 2023-04-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多