-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathindex.html
81 lines (80 loc) · 1.89 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
<html>
<head>
<title>Opossum Circuit Breaker Example</title>
<script type='text/javascript' src="/jquery.js"></script>
<script type='text/javascript' src="/opossum.js"></script>
<script type='text/javascript' src="/app.js"></script>
<style>
body {
font-family: Arial, Helvetica, sans-serif;
margin: 1em;
}
button {
padding: 1ex 1em;
margin-right: 1em;
font-size: larger;
}
.row {
padding: 1em;
width: 100%
}
.right {
float:right;
width: 50%;
}
h2 {
border-bottom: 1px dotted #999;
}
.clear {
cursor: pointer;
color: #3336ff;
}
.success {
color: darkgreen
}
.open {
color: red
}
.fallback {
color: darkblue
}
.rejected {
color: darkorange
}
.close {
color: green
}
.timeout {
color: darksalmon
}
</style>
</head>
<body>
<div>
<h1>Opossum Circuit Breaker Example</h1>
<p>
When you click the button here, this simple app calls a flakey web service that takes longer and longer to respond. The app's circuit breaker is configured to timeout after 500ms and execute a fallback command. Every 20 seconds, the flakey service is reset and the pattern is repeated.
</p>
<p>
If more than half of the requests error, then it begins to fail fast, rejecting the network call outright and executing the fallback function.
</p>
<p>
The <a href="/app.js">source code</a>.
</p>
<div class="row">
<button type="button" id="flakey">
Flakey Service
</button>
</div>
<div class="row right">
<h2>Circuit Breaker Statistics</h2>
<div id='stats'><p>...</p></div>
</div>
<div class="row">
<h2>Flakey Responses</h2>
<span class="clear">Click to clear</span>
<div id="flakeyResponse"></div>
</div>
</div>
</body>
</html>