paulwong

#

SPRING INTEGRATION RETRY

当使用httpOutBoundGateway时,有时会碰到网络抖动问题而出现连接异常,这时应该有个重试机制,如隔多少秒重试,重试多少次后放弃等。
默认是重试3次,每次重试间隔是20秒。

@SpringBootApplication
public class SpringIntegrationDslHttpRetryApplication {

    @SuppressWarnings("unchecked")
    public static void main(String[] args) {
        ConfigurableApplicationContext applicationContext =
                SpringApplication.run(SpringIntegrationDslHttpRetryApplication.class, args);
        Function<Object, Object> function = applicationContext.getBean(Function.class);
        function.apply("foo");
    }

    @Bean
    public IntegrationFlow httpRetryFlow() {
        return IntegrationFlows.from(Function.class)
                .handle(Http.outboundGateway("http://localhost:11111")
                                .httpMethod(HttpMethod.GET)
                                .expectedResponseType(String.class),
                        e -> e.advice(retryAdvice()))
                .get();
    }

    @Bean
    public RequestHandlerRetryAdvice retryAdvice() {
        return new RequestHandlerRetryAdvice();
    }

}

#打印日志
logging.level.org.springframework.retry=debug

Reference:
https://docs.spring.io/spring-integration/reference/html/handler-advice.html#retry-advice
https://stackoverflow.com/questions/49784360/configure-error-handling-and-retry-for-http-outboundgateway-spring-dsl
https://stackoverflow.com/questions/50262862/requesthandlerretryadvice-with-httprequestexecutingmessagehandler-not-working
https://stackoverflow.com/questions/63689856/spring-integration-http-outbound-gateway-retry-based-on-reply-content
https://blog.csdn.net/cunfen8879/article/details/112552420


posted @ 2021-08-23 13:01 paulwong 阅读(241) | 评论 (0)编辑 收藏

Gitee代码托管实践:让代码变得更加有序可靠

https://my.oschina.net/gitosc/blog/5187695

posted @ 2021-08-20 14:49 paulwong 阅读(159) | 评论 (0)编辑 收藏

Git/EGit | reset 和 revert 的区别

git的世界里有后悔药吗?

有的。不仅有,还不止一种:Reset 和 Revert。它们有什么区别呢?先说结论吧。

ResetRevert
作用 将某个commit之后的push全部回滚 将某个指定的commit回滚
历史记录(轨迹)
是否可作用于单个文件 否(都是作用于commit,与文件无关)

下面来说说具体例子。

Revert

试验步骤如下:

  1. 新建两个空白文件 Revert.txt 和 Common.txt,然后commit&push。
  2. 修改 Revert.txt 文件,内容为“commit 1”,然后commit&push,提交的备注为“commit 1 of Revert”
  3. 修改 Common.txt 文件,内容为“update for Revert(by commit 2)”
  4. 修改 Revert.txt 文件,新增一行,内容为“commit 2”
  5. 3 和 4的修改一起commit&push,提交备注为“commit 2 of Revert(Revert.txt + Common.txt)”

效果如下:

git-revert-01

图1-revert之前

目的

保留3的修改,回滚4的修改。

操作

选中“ Revert.txt ”文件,然后在 History 里选中 “commit 2 of Revert…”,右键,找到“Revert Commit”菜单,如图:

git-revert-02

图2-revert操作

点击后,效果如图:

git-revert-03

图3-revert之后

最后,push即可。

结果

未能达到预期效果,Revert.txt 和 Common.txt的修改都被撤销了。Revert的作用范围是一个commit(原子),跟文件的个数无关。

注:对最后一个commit做revert比较简单,两步:一,revert;二,push就可以了。对于较早的commit,因为中间间隔了其他的commit,文件会有冲突,需要处理完冲突才可以commit&push。

Reset

试验步骤如下:

  1. 新建空白文件 Reset.txt,然后commit&push。
  2. 修改 Reset.txt 文件,内容为“commit 1”
  3. 修改 Common.txt 文件,内容为“update for Reset(commit 1)”
  4. 2和3的修改一起commit&push,提交的备注为“commit 1 of Reset”
  5. 修改 Reset.txt 文件,新增一行,内容为“commit 2”,然后commit&push,提交的备注为“commit 2 of Reset”
  6. 修改 Reset.txt 文件,内容为“commit 3”
  7. 修改 Common.txt 文件,内容为“update for Reset(commit 3)”
  8. 6和7的修改一起commit&push,提交的备注为“commit 3 of Reset”

效果如下:

git-reset-04

图4-reset之前

目的

将commit 1 之后的(即commit 2 和 3)改动全部回滚。

操作

在 History 里找到“commit 1”,选中后,右键,找到 Reset 菜单,选择 Hard 模式。

git-reset-05

图5-reset

执行后,如下图所示,HEAD 已经指向里 commit 1,Common.txt 和 Reset.txt 的内容也已改变。注意左侧的项目栏,它已落后了服务器(GitHub)2个commit。怎么提交到服务器上呢?直接push,它会提示不是最新的,操作失败。这里要用到 push 的 force 属性。

git-reset-06

图6-reset之后

选中 项目,右键 – Team – Remote – Configure Push to Upstream,在打开的小窗口中找到 Advanced,如下图所示,这里的 Force Update 要勾上,表示强制覆盖。

重新push,就可以跟服务器保持同步了。

git-reset-07

图7-push-force

要特别注意的是,Reset慎用,跟Linux的“rm -rf /”有异曲同工之妙。

http://www.youngzy.com/blog/2019/08/git-difference-between-reset-and-revert-using-eclipse/

posted @ 2021-08-17 10:37 paulwong 阅读(205) | 评论 (0)编辑 收藏

Jenkins environment variables

https://medium.com/@mukeshsingal/access-jenkins-global-environment-variables-using-groovy-or-java-b5c1e6b53685

posted @ 2021-08-16 15:46 paulwong 阅读(190) | 评论 (0)编辑 收藏

怎么提高自己的系统架构水平

https://my.oschina.net/u/4662964/blog/5135740

posted @ 2021-08-04 11:05 paulwong 阅读(171) | 评论 (0)编辑 收藏

JSR-303 Bean Validation - Grouping Javax Validation Constraints

@NotBlank(message = "Missing ID_IMG_CHECK.")

以上标签进行验证时是无条件验证,如果想在特定条件下才验证,则不适用。

于是才有如下设定:
@NotBlank(message = "Missing ID_IMG_CHECK.", groups = {GroupA.class} )

手动验证:
Class<?> [] classArray = classList.toArray(new Class<?>[0]);
LOGGER.info("subVersion : {}, Validate class : {}", subVersion, classNameList);
CompositeException compositeException = new CompositeException();
Set<ConstraintViolation<QueryKycResultDetail>> groupSet = validator.validate(queryKycResultDetail, classArray);

https://www.baeldung.com/javax-validation-groups

posted @ 2021-07-29 10:00 paulwong 阅读(238) | 评论 (0)编辑 收藏

Linux sha512sum command

检查file的SHA512值:

sha512sum [OPTION] [FILE]

posted @ 2021-07-14 13:41 paulwong 阅读(265) | 评论 (0)编辑 收藏

构建ARTEMIS集群

     摘要: 如果多个ARTEMIS以单体的方式启动,则各个实例互不相关,不能实现高可用。集群因此需将多个实例组队--集群,以实现高可用,即集群内可实现实例的失败转移,消息的负载均衡,消息的重新分配。这需要在集群配置区指定所有所有实例的IP和PORT。但集群实例如果DOWN机,其保存的消息也会随之消失,因此需要实现高可用,有两种方式:共享存储及消息复制。共享存储共享存储是由master/slave对组成,指两个...  阅读全文

posted @ 2021-06-30 16:33 paulwong 阅读(1363) | 评论 (0)编辑 收藏

NAS vs. SAN - What Are the Differences Between Them

https://www.backblaze.com/blog/whats-the-diff-nas-vs-san/

NAS vs. SAN: Differences and Use Cases
https://www.enterprisestorageforum.com/networking/nas-vs-san-differences-and-use-cases/

DAS / NAS / IP SAN / FC SAN区别
https://cloud.tencent.com/developer/article/1580887

posted @ 2021-06-25 15:18 paulwong 阅读(176) | 评论 (0)编辑 收藏

Spring Boot 2.x基础教程:使用LDAP来管理用户与组织数据

http://blog.didispace.com/spring-boot-learning-24-6-2/

posted @ 2021-06-21 09:21 paulwong 阅读(221) | 评论 (0)编辑 收藏

仅列出标题
共110页: First 上一页 3 4 5 6 7 8 9 10 11 下一页 Last