File tree 2 files changed +15
-0
lines changed
mse-simple-demo/C/src/main/java/com/alibabacloud/mse/demo
2 files changed +15
-0
lines changed Original file line number Diff line number Diff line change 19
19
import javax .servlet .http .HttpServletRequest ;
20
20
21
21
import org .springframework .beans .factory .annotation .Autowired ;
22
+ import org .springframework .beans .factory .annotation .Value ;
22
23
import org .springframework .boot .SpringApplication ;
23
24
import org .springframework .boot .autoconfigure .SpringBootApplication ;
24
25
import org .springframework .cloud .client .loadbalancer .LoadBalanced ;
@@ -55,8 +56,14 @@ class AController {
55
56
@ Autowired
56
57
InetUtils inetUtils ;
57
58
59
+ @ Value ("${throwException:false}" )
60
+ boolean throwException ;
61
+
58
62
@ GetMapping ("/c" )
59
63
public String c (HttpServletRequest request ) {
64
+ if (throwException ) {
65
+ throw new RuntimeException ();
66
+ }
60
67
return "C" + SERVICE_TAG + "[" + inetUtils .findFirstNonLoopbackAddress ().getHostAddress () + "]" ;
61
68
}
62
69
}
Original file line number Diff line number Diff line change @@ -28,9 +28,17 @@ public class HelloServiceCImpl implements HelloServiceC {
28
28
@ Value ("${rocketmq.consumer.topic}" )
29
29
private String topic ;
30
30
31
+
32
+ @ Value ("${throwException:false}" )
33
+ boolean throwException ;
34
+
31
35
@ Override
32
36
public String hello (String name ) {
33
37
38
+ if (throwException ) {
39
+ throw new RuntimeException ();
40
+ }
41
+
34
42
String value = "C" + SERVICE_TAG + "[" + inetUtils .findFirstNonLoopbackAddress ().getHostAddress () + "]" ;
35
43
String invokerTag ="" ;
36
44
String userData = RpcContext .getContext ().getAttachment ("__microservice_tag__" );
You can’t perform that action at this time.
0 commit comments