<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                企業??AI智能體構建引擎,智能編排和調試,一鍵部署,支持知識庫和私有化部署方案 廣告
                使用的springboot2.x ## maven依賴 ~~~ <dependency> <groupId>org.springframework.retry</groupId> <artifactId>spring-retry</artifactId> </dependency> ~~~ ## 啟動類 ~~~ @EnableRetry ~~~ ## 使用 再要重試的方法上添加注解, 需要拋出異常, 常規導致注解不生效的原因這個注解一樣也會, 之前要重試的方法是寫在工具類的static里, 就無法重試 (注解不生效), 后來就是把工具類弄成交給spring管理的普通類普通方法, 方法也是@Autowired 導入后調用, 就正常了 ~~~ @Retryable(value = BusinessException.class, maxAttempts = 3, backoff = @Backoff(value = 3000) ) value : 表示捕獲的異常, 進行觸發重試, maxAttempts 重試次數, backoff = @Backoff(value = 3000) 每次重試間隔3秒 ~~~ 重試次數耗盡還是失敗, 可以用@Recover , 方法第一個參數是捕獲的異常, 其他和@Retryable的方法完全一樣 ~~~ @Recover ~~~ ## 參考示例 只有重試功能核心代碼, 業務代碼沒有 ~~~ @Retryable(value = BusinessException.class, maxAttempts = 3, backoff = @Backoff(value = 3000) ) public Map<String, String> sendWeChatText(String userId, String content) { // 處理業務和其他內容省略 // 有問題, 拋出自定義異常, 觸發重試 if .... throw new BusinessException(""); } ~~~ @Recover public Map<String, String> sendWeChatText(BusinessException e, String userId, String content) { log.error(" sendWeChatText 發送多次仍然失敗 ", e); throw e; } 調用者, 另一個類 ~~~ // 其他忽略 try { map = wxUtils.sendWeChatText(userId, content); catch (Exception e) { log.error("推送失敗", e); } ~~~
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看