|
. z" Y5 [. o K( b Biz-SIP金融级业务中台(http://bizsip.bizmda.com)是一套基于领域驱动设计(DDD)架构,能快速构建金融级云原生架构的服务整合中间件,整合了在金融场景里锤炼出来的最佳实践分布式事务是分布式系统架构设计中的一个技术难点,特别是在这几年越来越火的微服务架构中,服务拆分所带来的跨服务数据一致性问题亟待解决,而在金融系统中,这个问题更是备受关注。 " l2 t8 }$ A' }, B! n% Q+ x4 @
在Biz-SIP金融业务中台中,是利用App延迟服务,来提供对分布式事务的支持,主要场景有:1. 重试通知:通知对方系统,如果对方系统没有响应,会重新发起通知交易,直到对方给出明确的回复响应2. 向前补偿:调用第三方服务后,超时没有响应,系统会后续发起查询上笔交易状态的查询交易,如果对方系统还是没响应,会多次重试再发起交易状态查询,并根据查询交易状态来决定继续完成后续服务步骤(上笔交易终态查询结果为已成功)还是对以前服务步骤发起补偿(冲正)操作(上笔交易终态查询结果为未成功)。 ' C' m& a9 q" t: l( d+ Z
3. 向后补偿:调用第三方服务后,超时没有响应,系统会立即发起针对此交易的补偿交易,如果对方系统还是没响应,会多次重试再发起补偿交易补偿成功后,会对以前服务步骤依次发起补偿(冲正)操作;如果补偿失败,会置交易失败,由人工介入处理。 - m! N. C$ c% g1 E
调用App延迟服务案例,是通过Biz-SIP的开放API接口,调用App服务,再由App服务发起对App延迟服务的多次重试调用: , @3 }0 Q9 ?: C, W2 o% e
在以上案例中,有2个App服务:/bean/sample15:正常的App服务,被开放API接口所调用,模拟在特定场景(发起重试通知、调用第三方应用后无响应)中调用App延迟服务;/bean/sample15-delay:被调用的App延迟服务,模拟和第三方应用交互的不同场景(无响应、返回错误、返回成功)。
7 @' y" H/ l1 Q7 |0 I8 Q5 H 具体代码和配置可以查看Biz-SIP源代码中的Sample相关测试案例(https://gitee.com/szhengye/biz-sip)一、App层App服务的开发和配置首先,我们需要编写一个App服务类(Sample15AppService.java):
' a: J8 o+ m+ G; i) @- W0 e @Slf4j@ServicepublicclassSample15AppServiceimplementsAppBeanInterface{
9 o2 X2 s# J9 Q/ F private BizMessageInterface bizMessageInterface
s7 v: R( Z, \( z$ t! I8 Z$ C = AppClientFactory.getDelayAppServiceClient(
9 F* K. T7 }7 p" c( \, I u3 \( d# Y" F BizMessageInterface
# G5 q7 t( H" t+ V4 O( h# c3 a' S$ [ .class, "/bean/sample15-delay",, Z0 t8 x& e2 J6 t+ g
0,1000, 2000, 4000, 8000, 16000);@Overridepublic JSONObject process(JSONObject message) throws BizException {
c: d9 }) z/ B BizMessage bizMessage =
4 L. Z- T( h4 _: t" s this.bizMessageInterface.call(message);
) f$ V$ P- \0 o/ L return bizMessage.getData();( Y6 n( j- E: O. M$ V
}
+ d7 W Y) @! p# T9 } }Sample15AppService类继承了AppBeanInterface接口,实现了process()方法。
# e4 ]4 V% k& M$ ]6 T Sample15AppService类中申请了调用“/bean/sample15-delay”App延迟服务的调用接口bizMessageInterface,在process()方法中,通过这个接口,来调用App延迟服务。 3 ~% C+ O# |' Q
接着,我们还需要编写一个App服务类作为App延迟服务(Sample15DelayAppService.java):@Slf4j& x& f1 u' |7 T. u; B1 {5 l
@ServicepublicclassSample15DelayAppService
j# |5 U( p* |* t. t/ k' N3 A implementsAppBeanInterface{
& c/ h4 Q/ [. W: g5 m) K3 ^ @Overridepublic JSONObject process(JSONObject message)throws BizException 3 d6 h) j, b: ?4 V |% ^; R* z) K
{3 h# `0 c/ c6 C- Y9 x
log.info("延迟App服务调用第[{}]次: \n{}",
( d4 D! C; _) e! Q( @$ @ BizUtils.getDelayRetryCount(),
( E9 I: V& y( A8 |/ p0 [, W BizUtils.buildJsonLog(message));
0 g. G5 X# n( G9 l/ o" @" ]+ n 4 d2 x- v. } [7 A: N9 G0 R
int maxRetryCount = message.getInt("maxRetryCount");
$ u* C$ H' |5 j k. y5 Y String result = (String) message.get("result"
i+ |# B1 b1 c8 e7 x );
# h. G; V# B" ?5 e! @7 y# | if (BizUtils.getDelayRetryCount() >= maxRetryCount) {6 K8 l$ d# b9 Y& u; I2 I
if ("success".equalsIgnoreCase(result)) {) o' d% o+ c: R' ~0 Z! ]+ e, K5 Z
log.info( 1 _( k+ A: T/ q. F3 n) S1 y
"返回成功!");
' u" c- }$ i# V5 Q! x return message;! j" e+ C. E0 f2 {- [
}
; e! I( u) X) ^0 a4 ~$ K j9 |5 U3 B else {
* @3 f; R0 A5 M4 c$ A2 e% ? log.info("返回错误!"
2 y. ], n7 }, f" X* Y( _5 Q3 A) X );7 u5 B, C! ^5 X7 @! v' K
thrownew BizException(BizResultEnum.OTHER_ERROR,"Sample15DelayAppService调用错误!");
0 j+ ~$ ]1 K, r$ G- y( i e# j }! J, J$ P$ t3 n0 c
}
4 e4 z8 p0 W9 P$ C$ F log.info(
3 r' |) B# q, U* @ "抛出延迟App服务重试异常,触发下一次调用...");
' u1 g1 j( J8 v2 D thrownew BizException(BizResultEnum.RETRY_DELAY_APP_SERVICE);
% y; W1 I$ C6 b- `4 H. | }3 R$ L7 j+ \, B% \& e( F6 q
}
# Z9 T; Z, W# g+ ~3 v! k Sample15AppService类同样继承了AppBeanInterface接口,实现了process()方法Sample15AppService类中,会根据传入报文中的“maxRetryCount”来决定调用次数,在没达到maxRetryCount约定的最大重试次数时,会直接抛出App服务重试异常(异常错误码为BizResultEnum.RETRY_DELAY_APP_SERVICE);传入报文中的“result”为达到最大重试次数后是返回成功(result为“success”)还是直接抛出异常(除App服务重试异常以外的其它BizException异常)。 0 `6 \3 R' z H6 m8 w! A: u3 l
然后,在app.yml中,需要配置这二个App服务:- app-service-id: /bean/sample15
v7 r0 O' f$ {% `* [3 _ type: app-bean-service$ |" ^( F. r+ T( k, n
class-name: com.bizmda.bizsip.sample.app.service.Sample15AppService - [3 a+ \ U f) D
p0 b; G, L r3 ?- b% b8 D3 A: ?- S2 v2 ` h5 c0 o7 n
- app-service-id: /bean/sample15-delay% Z `7 H3 H F1 R; R, t
type: app-bean-service$ x. M5 \/ Y" |, w
class-name: com.bizmda.bizsip.sample.app.service.Sample15DelayAppService
$ R6 ]5 r6 B2 k. t7 g, E 二、启动应用进行测试启动SampleAppApplication应用,通过OpenAPI接口进行测试首先,请求报文中设置最大重试次数(maxRetryCount)为4,最终返回结果(result)为“success”。 " M9 M7 z& }; |; Y" t3 a% R
$ curl -H "Content-Type:application/json" -H "Biz-Service-Id:/bean/sample15" -X POST --data{"maxRetryCount":4,"result":"success"}
# C' A, F0 ^4 u& F http://localhost:8888/api|jq
( @) u! y# a' Q! D' E0 |! @9 _. G" Z9 s
{/ R2 `1 l1 M s+ B) M. }
"code": 0,& y; k% _4 g5 G; d+ t
"message": "success",
$ _# G! p" ?1 n) q" M; z2 ~ "extMessage": null,
i9 C1 R1 h: Q, X$ o Z. O0 Q9 [ "appServiceId" : J- G) l1 W9 K
: "/bean/sample15",/ i2 i+ h+ j# d3 \$ S
"traceId": "35a40e4bace44883bcb6511a3b016b82",
& F* I# t0 d' r "parentTraceId": null, ?0 L3 J! X6 ?# Q, }
"timestamp" + Q/ d: j5 \0 I" s9 Z
: 1648358690842,
3 e z9 i7 y: F% r9 O4 t "data": {
# u2 C' x7 q* U: Y "maxRetryCount": 4," V3 L+ x7 b" O# p) ?) n
"result": "success"( T+ ^# p) X3 h6 O( }% n
}
' E( ?$ W7 |8 i/ R p4 ~# d }SampleAppApplication应用中被调用的Sample15DelayAppService类打印日志: 6 `% A" G8 y1 n% |# t7 A
[bizsip-integrator:192.169.1.103:8888] 13:24:50 INFO 70936 [7a36a3f4c22e40a49792931645570553] [org.springframework.amqp.rabbit.RabbitListenerEndpointContainer & w% h9 r4 {: Q- N7 v
#1-4] c.b.b.s.a.s.Sample15DelayAppService 延迟App服务调用第[1]次:5 ~* U R7 A5 _, K$ k" C
{
0 j! ?. }7 ^$ U5 ?7 F. I: d "maxRetryCount": 4,
8 E1 s8 q# s; h& Y2 m& C& \, T "result" 9 c9 e7 }0 I4 J+ v& M
: "success"1 W: @. Y+ [+ ]) {3 W7 C, x
}
0 p. Q' y8 ~/ r7 \0 C1 N; r3 ? [bizsip-integrator:192.169.1.103:8888] 13:24:50 INFO 70936 [7a36a3f4c22e40a49792931645570553] [org.springframework.amqp.rabbit.RabbitListenerEndpointContainer
7 t0 b! ^" B: {# s #1-4] c.b.b.s.a.s.Sample15DelayAppService 抛出延迟App服务重试异常,触发下一次调用...
) ?7 D* j$ B9 D: | [bizsip-integrator:192.169.1.103:8888] 13:24:51 INFO 70936 [7a36a3f4c22e40a49792931645570553] [org.springframework.amqp.rabbit.RabbitListenerEndpointContainer * c" U! d ]! w1 p% v
#1-3] c.b.b.s.a.s.Sample15DelayAppService 延迟App服务调用第[2]次:
/ V j7 n2 g, C3 K5 E {. _. r2 I1 ?: s
"maxRetryCount": 4,
6 @; x0 S* k2 S: }5 {* g" } "result" 7 n: c! S' A! o) w0 e" y! l, B5 Q
: "success"
9 C) L' i# o; o3 {; o }
# ` [2 c. P' @6 Y' i& e [bizsip-integrator:192.169.1.103:8888] 13:24:51 INFO 70936 [7a36a3f4c22e40a49792931645570553] [org.springframework.amqp.rabbit.RabbitListenerEndpointContainer ! r% ?/ [2 }( p( A* V, S$ {
#1-3] c.b.b.s.a.s.Sample15DelayAppService 抛出延迟App服务重试异常,触发下一次调用...* z& i2 g: o" {; ^1 H: @" X1 k) R
[bizsip-integrator:192.169.1.103:8888] 13:24:53 INFO 70936 [7a36a3f4c22e40a49792931645570553] [org.springframework.amqp.rabbit.RabbitListenerEndpointContainer 6 }4 |+ U) ^0 R6 U* N* w
#1-2] c.b.b.s.a.s.Sample15DelayAppService 延迟App服务调用第[3]次:+ r$ C; Y: d: a0 D8 R5 e
{
" `( H9 w( L. Z' N4 p2 t8 D! k "maxRetryCount": 4,+ r2 J4 H% X# s: {7 g+ w: d
"result"
8 D8 J, s2 V! [" V" Y3 L% ?( }8 K : "success"
, n- k2 q3 j9 D, n }6 N6 Q5 A; {7 y% Z, B
[bizsip-integrator:192.169.1.103:8888] 13:24:53 INFO 70936 [7a36a3f4c22e40a49792931645570553] [org.springframework.amqp.rabbit.RabbitListenerEndpointContainer # X4 O' I5 y; ^4 S0 q
#1-2] c.b.b.s.a.s.Sample15DelayAppService 抛出延迟App服务重试异常,触发下一次调用...$ Y6 |* x' A6 Z
[bizsip-integrator:192.169.1.103:8888] 13:24:58 INFO 70936 [7a36a3f4c22e40a49792931645570553] [org.springframework.amqp.rabbit.RabbitListenerEndpointContainer ; T& @& I/ \' y: ]; J5 S
#1-1] c.b.b.s.a.s.Sample15DelayAppService 延迟App服务调用第[4]次:
* |) C( ]1 {( x3 k) w3 ? {! D5 I0 R( p7 \9 y7 q, J& j) s
"maxRetryCount": 4,
7 X* T5 K2 o |% k "result" # `: X" e( E- g, n2 n+ y
: "success"
0 l' `& |% P8 k/ r! e1 [: m }
` [; S$ P! K, y' d% C+ b [bizsip-integrator:192.169.1.103:8888] 13:24:58 INFO 70936 [7a36a3f4c22e40a49792931645570553] [org.springframework.amqp.rabbit.RabbitListenerEndpointContainer ' @) U6 Q* f; d! c) S
#1-1] c.b.b.s.a.s.Sample15DelayAppService 返回成功!可以看到Sample15DelayAppService类一共被调用了4次,最后返回成功,中间的时间间隔分别为1秒、2秒、5秒(时间精确度关系,略有误差)。
; b1 r$ |- K2 \# v 其次,请求报文中设置最大重试次数(maxRetryCount)为3,最终返回结果(result)为“fail”$ curl -H "Content-Type:application/json" -H "Biz-Service-Id:/bean/sample15" ! [# @% ^' K" F& j1 x3 I9 ^
-X POST --data{"maxRetryCount":3,"result":"fail"} http://localhost:8888/api|jq
/ C8 W) }9 E' v1 X% z
7 K7 b7 _; R( q7 ~ {2 ^6 Z' |/ J5 d9 m) Z# ^5 P
"code": 0,
: ]$ M1 o3 [. V6 v0 _5 l' K6 Y6 ~ "message" + U& W4 B& i9 J4 K
: "success",( _6 l) k. ~& u9 T- `* W
"extMessage": null,
5 w" I# c6 t- ]- O% G$ ` "appServiceId": "/bean/sample15",
- c6 s7 [7 ^$ D. f: \( G "traceId": "a60d017e00554dd6a779a478ced2c7f5"
! S2 u6 L/ j7 e% e# } @ ,6 N4 P& j% ~9 B( a
"parentTraceId": null,
3 L% j1 }& ^6 F "timestamp": 1648359627667,( _# m4 `' h% u; d9 y0 h% F& z1 f/ G
"data": {- b. G1 e) ~2 [0 C7 J' F
"maxRetryCount": 3,9 x; c" z* x {; Y- j
"result" % k" Y# N7 @0 s$ D" ]& C& F
: "fail"8 ^6 ?* K f- c2 k$ X) i+ G
}- [+ k: D" K/ v0 C _. l8 \
}SampleAppApplication应用中被调用的Sample15DelayAppService类打印日志:[bizsip-integrator:192.169.1.103:8888] 13:40:27 INFO 70936 [2b2564ca72d74251b3e1d7bac2a99242] [org.springframework.amqp.rabbit.RabbitListenerEndpointContainer ! j, G$ E: ]- }# V" G4 T* E
#1-5] c.b.b.s.a.s.Sample15DelayAppService 延迟App服务调用第[1]次:
6 T5 p# p$ t6 z$ Q) m {
- r/ c9 z! X9 \; @ "maxRetryCount": 3,( c; A5 i1 R& d0 w5 J
"result"
7 A1 @+ Y6 z' G: z; H G' {% S : "fail"
* L7 n& W1 I7 M) r+ U$ R4 T2 Q }# |) H) m, y& B0 u F
[bizsip-integrator:192.169.1.103:8888] 13:40:27 INFO 70936 [2b2564ca72d74251b3e1d7bac2a99242] [org.springframework.amqp.rabbit.RabbitListenerEndpointContainer
, W, D. n8 ~! Z. i& e3 o #1-5] c.b.b.s.a.s.Sample15DelayAppService 抛出延迟App服务重试异常,触发下一次调用...0 D8 L0 \! L" p; t/ G" E, R
[bizsip-integrator:192.169.1.103:8888] 13:40:28 INFO 70936 [2b2564ca72d74251b3e1d7bac2a99242] [org.springframework.amqp.rabbit.RabbitListenerEndpointContainer
! N' _& q4 [" ], i" b #1-4] c.b.b.s.a.s.Sample15DelayAppService 延迟App服务调用第[2]次:# Q, F7 K- D; O* b# Q
{
4 b; \7 Z' G; z8 w! s "maxRetryCount": 3,+ Y% x/ d' x0 j7 E
"result"
' z/ J$ _7 p8 K+ X : "fail"" n0 e8 j, R5 s8 J8 h
}8 Y& I6 q+ F+ D) O4 P) ^
[bizsip-integrator:192.169.1.103:8888] 13:40:28 INFO 70936 [2b2564ca72d74251b3e1d7bac2a99242] [org.springframework.amqp.rabbit.RabbitListenerEndpointContainer
9 G1 V B7 c- m2 ] X# p. s #1-4] c.b.b.s.a.s.Sample15DelayAppService 抛出延迟App服务重试异常,触发下一次调用..., |4 f4 ~4 q( f+ i6 v: E V3 g
[bizsip-integrator:192.169.1.103:8888] 13:40:30 INFO 70936 [2b2564ca72d74251b3e1d7bac2a99242] [org.springframework.amqp.rabbit.RabbitListenerEndpointContainer
$ b6 M4 n0 f9 o9 i# F/ [; @ #1-3] c.b.b.s.a.s.Sample15DelayAppService 延迟App服务调用第[3]次:* h& y* W2 \1 E0 d
{9 W2 z! E& z" G( ]( D3 b
"maxRetryCount": 3,$ L# p" W+ w) F1 R; k
"result" ! A% f. O6 t2 |6 _. S! F
: "fail"8 M& d* U7 {/ ~) Q c4 _
}; V0 U9 b; @) |+ r6 I: M' @
[bizsip-integrator:192.169.1.103:8888] 13:40:30 INFO 70936 [2b2564ca72d74251b3e1d7bac2a99242] [org.springframework.amqp.rabbit.RabbitListenerEndpointContainer # j# D6 w& V! r5 ]
#1-3] c.b.b.s.a.s.Sample15DelayAppService 返回错误!可以看到Sample15DelayAppService类一共被调用了3次,最后返回失败,中间的时间间隔分别为1秒、2秒。
0 S& g3 ^: g$ E3 d/ ~# Y" o( | 最后,请求报文中设置最大重试次数(maxRetryCount)为8,最终返回结果(result)为“success”$ curl -H "Content-Type:application/json" -H 9 V/ y/ y! w/ G3 A) Q. a4 M, k
"Biz-Service-Id:/bean/sample15" -X POST --data{"maxRetryCount":8,"result":"success"} http://localhost:8888/api|jq
5 S4 E) O( z4 g, W1 W) F! X+ ^
1 L# t/ Z; @& m5 e& f/ z8 ~7 H
$ I: }& U) p! r1 j3 P {7 r' g2 a \! u7 K c( f
"code": 0,0 Z% r$ Q, r8 ~# k. G; B" m
"message": "success",
3 B+ s1 P! V, {& s "extMessage": null,
, \' J1 s1 g8 p! C( a: Z "appServiceId": "/bean/sample15",$ L# ?0 B0 M; ~: R
- {, ~8 ]; c% \/ I* b# X* y
"traceId": "19e559c658954b35861a32369b08f5b1",
' L& M. ]* f" h "parentTraceId": null,7 W/ b9 h/ H# m5 v1 c
"timestamp": 1648359793722,. i- G* p. Y% t' f' q" U
/ k4 t, @5 ?) C4 ?# {6 Y7 }$ j "data": {# S; w9 l9 Q5 V5 b
"maxRetryCount": 8,
- }* I' f1 r( v& V "result": "success"
& o* N) A/ L0 k4 _ }7 G: Q+ J1 B( ], _5 Q2 B! l$ H% y) n
}SampleAppApplication应用中被调用的Sample15DelayAppService类打印日志:
7 |3 \/ Y" g) l$ [9 F/ c [bizsip-integrator:192.169.1.103:8888] 13:43:13 INFO 70936 [6040bebfe86545e5a5bdbf36e4e25376] [org.springframework.amqp.rabbit.RabbitListenerEndpointContainer 4 |5 k- c8 N7 a0 c% e3 t5 A8 g
#1-2] c.b.b.s.a.s.Sample15DelayAppService 延迟App服务调用第[1]次:1 p; y$ | M- d; w n
{
1 E1 ?6 y2 H) z F0 _: { "maxRetryCount": 8,+ ?0 P; S6 v/ z& U0 K0 t2 Y6 H4 G
"result" / D- l. o6 N% P* B" p$ D
: "success"
1 g0 R' E' K+ a5 @% h }2 o5 j1 r. t# D) v1 N, Q
[bizsip-integrator:192.169.1.103:8888] 13:43:13 INFO 70936 [6040bebfe86545e5a5bdbf36e4e25376] [org.springframework.amqp.rabbit.RabbitListenerEndpointContainer
9 m: r9 s. {) H- e% s. | #1-2] c.b.b.s.a.s.Sample15DelayAppService 抛出延迟App服务重试异常,触发下一次调用...
: p/ ^* f+ M& [. }. l [bizsip-integrator:192.169.1.103:8888] 13:43:14 INFO 70936 [6040bebfe86545e5a5bdbf36e4e25376] [org.springframework.amqp.rabbit.RabbitListenerEndpointContainer
3 A+ M. W" y C( |+ @ #1-1] c.b.b.s.a.s.Sample15DelayAppService 延迟App服务调用第[2]次:- I8 L- Q! R1 o" Q" k. ^
{
' V- U8 F* H, B0 u* m) w9 x- K; A "maxRetryCount": 8,
: f! F4 h B/ H7 x* E/ Z "result" 7 W7 ~8 a8 x9 s9 \- A' C- P
: "success"
8 H# M' M8 d1 C/ j0 b/ p, z }
4 ^9 N: z/ U# H! s [bizsip-integrator:192.169.1.103:8888] 13:43:14 INFO 70936 [6040bebfe86545e5a5bdbf36e4e25376] [org.springframework.amqp.rabbit.RabbitListenerEndpointContainer
, ~* J; t, m3 n' p) n1 o2 M( @ #1-1] c.b.b.s.a.s.Sample15DelayAppService 抛出延迟App服务重试异常,触发下一次调用...
# s. ^ a0 U% a) B9 J [bizsip-integrator:192.169.1.103:8888] 13:43:16 INFO 70936 [6040bebfe86545e5a5bdbf36e4e25376] [org.springframework.amqp.rabbit.RabbitListenerEndpointContainer
/ A4 o: D" f5 \ #1-5] c.b.b.s.a.s.Sample15DelayAppService 延迟App服务调用第[3]次:
M, }7 @% ?/ a. w5 b* a8 K8 R$ z {6 d* g4 |5 {4 j! W8 ^: Y
"maxRetryCount": 8,# W9 W* ?3 Q- w
"result"
2 U8 j& D3 D6 j# n; Q7 C : "success"% A3 h7 j% u, O+ v$ H# G
}+ U0 @* @& }' c0 K1 q. E( Z
[bizsip-integrator:192.169.1.103:8888] 13:43:16 INFO 70936 [6040bebfe86545e5a5bdbf36e4e25376] [org.springframework.amqp.rabbit.RabbitListenerEndpointContainer H f+ H: N- e& Q
#1-5] c.b.b.s.a.s.Sample15DelayAppService 抛出延迟App服务重试异常,触发下一次调用...; K9 U) Z, I* s: }8 \
[bizsip-integrator:192.169.1.103:8888] 13:43:20 INFO 70936 [6040bebfe86545e5a5bdbf36e4e25376] [org.springframework.amqp.rabbit.RabbitListenerEndpointContainer
/ O* S0 y8 R5 x+ j1 V" w* G8 _ D$ T #1-4] c.b.b.s.a.s.Sample15DelayAppService 延迟App服务调用第[4]次:
; ~! { @; e- l# f* t {
+ y4 k2 T$ {$ x0 i3 B% D "maxRetryCount": 8,
2 ]: z! m6 |- w4 a4 c, @ "result" 3 T3 f5 O" ?6 @ ~4 W/ B
: "success"
" \% o' H5 W( J" X3 D6 }- x }! a2 |( h6 e1 l
[bizsip-integrator:192.169.1.103:8888] 13:43:20 INFO 70936 [6040bebfe86545e5a5bdbf36e4e25376] [org.springframework.amqp.rabbit.RabbitListenerEndpointContainer k: f/ X1 L8 E
#1-4] c.b.b.s.a.s.Sample15DelayAppService 抛出延迟App服务重试异常,触发下一次调用...6 i* ]& k# a, t8 Q+ ^/ s" A* G
[bizsip-integrator:192.169.1.103:8888] 13:43:28 INFO 70936 [6040bebfe86545e5a5bdbf36e4e25376] [org.springframework.amqp.rabbit.RabbitListenerEndpointContainer
' z" q9 ^$ |2 }/ T$ j #1-3] c.b.b.s.a.s.Sample15DelayAppService 延迟App服务调用第[5]次:
+ j( K. ^ ?: `# L {& F/ F' z' S- `5 g/ }
"maxRetryCount": 8,' y; a7 f1 F3 \
"result"
/ V( U' e+ N) r4 J. @; ~) v9 M : "success"
$ k+ g3 ?( j1 N2 [7 a }
" Z# @% A5 g/ U [bizsip-integrator:192.169.1.103:8888] 13:43:28 INFO 70936 [6040bebfe86545e5a5bdbf36e4e25376] [org.springframework.amqp.rabbit.RabbitListenerEndpointContainer
: `" j4 ^- s1 Q+ y1 E U' p$ G# G #1-3] c.b.b.s.a.s.Sample15DelayAppService 抛出延迟App服务重试异常,触发下一次调用...5 P; H) p# R, r' x8 h1 }8 z* u/ Z
[bizsip-integrator:192.169.1.103:8888] 13:43:44 INFO 70936 [6040bebfe86545e5a5bdbf36e4e25376] [org.springframework.amqp.rabbit.RabbitListenerEndpointContainer + F" t* Y2 S' }5 h
#1-2] c.b.b.s.a.s.Sample15DelayAppService 延迟App服务调用第[6]次:3 T* S% m: a! ]: ?" h0 \6 |( m
{9 i% H! y9 E5 N, z) u& d2 c
"maxRetryCount": 8,
, K0 o p3 U, O "result" ^. [" G# o3 }
: "success", E( X5 u% M# Z* ~& Q
}" ^4 O! C. H. @! ~: l
[bizsip-integrator:192.169.1.103:8888] 13:43:44 INFO 70936 [6040bebfe86545e5a5bdbf36e4e25376] [org.springframework.amqp.rabbit.RabbitListenerEndpointContainer
! s) y) T( Z8 v% k #1-2] c.b.b.s.a.s.Sample15DelayAppService 抛出延迟App服务重试异常,触发下一次调用...
* w* L( m/ q4 l; q) X* e& R3 _ [bizsip-integrator:192.169.1.103:8888] 13:43:44 WARN 70936 [6040bebfe86545e5a5bdbf36e4e25376] [org.springframework.amqp.rabbit.RabbitListenerEndpointContainer
% \8 Q: z( X# j; {9 f: k* R2 k #1-2] c.b.b.a.l.DelayAppServiceQueueListener 延迟App服务重试次数超过次数[6],服务失败!可以看到Sample15DelayAppService类一共被调用了6次,最后提示“延迟App服务重试次数超过次数[6],服务失败!”,中间的时间间隔分别为1秒、2秒、4秒、8秒、16秒。
, Z, z/ m, Y8 [0 ` X Biz-SIP官方网站:http://bizsip.bizmda.comGitee:https://gitee.com/szhengye/biz-sip 8 ?5 h9 d, j; r- S2 ^
* g( A: X0 E% _0 V. [1 b+ K6 U
! l' d9 d+ O% t( j# w4 J3 t) ?5 U7 s+ T- p
: l/ s) N8 [) e( W) F1 x) z |