├── .gitignore ├── LICENSE ├── README.md ├── angular ├── README.md ├── client │ ├── .editorconfig │ ├── .gitignore │ ├── .prettierrc │ ├── README.md │ ├── angular.json │ ├── browserslist │ ├── e2e │ │ ├── protractor.conf.js │ │ ├── src │ │ │ ├── app.e2e-spec.ts │ │ │ └── app.po.ts │ │ └── tsconfig.json │ ├── karma.conf.js │ ├── package-lock.json │ ├── package.json │ ├── src │ │ ├── app │ │ │ ├── app.component.html │ │ │ ├── app.component.scss │ │ │ ├── app.component.spec.ts │ │ │ ├── app.component.ts │ │ │ ├── app.module.ts │ │ │ ├── button │ │ │ │ ├── button.component.html │ │ │ │ ├── button.component.scss │ │ │ │ ├── button.component.spec.ts │ │ │ │ └── button.component.ts │ │ │ ├── response-card │ │ │ │ ├── response-card.component.html │ │ │ │ ├── response-card.component.scss │ │ │ │ ├── response-card.component.spec.ts │ │ │ │ └── response-card.component.ts │ │ │ ├── response-list │ │ │ │ ├── response-list.component.html │ │ │ │ ├── response-list.component.scss │ │ │ │ ├── response-list.component.spec.ts │ │ │ │ └── response-list.component.ts │ │ │ └── stats-card │ │ │ │ ├── stats-card.component.html │ │ │ │ ├── stats-card.component.scss │ │ │ │ ├── stats-card.component.spec.ts │ │ │ │ └── stats-card.component.ts │ │ ├── assets │ │ │ └── .gitkeep │ │ ├── environments │ │ │ ├── environment.prod.ts │ │ │ └── environment.ts │ │ ├── favicon.ico │ │ ├── index.html │ │ ├── main.ts │ │ ├── polyfills.ts │ │ ├── styles.scss │ │ └── test.ts │ ├── tsconfig.app.json │ ├── tsconfig.json │ ├── tsconfig.spec.json │ └── tslint.json ├── images │ ├── angular-browser.png │ └── angular-terminal.png ├── package-lock.json ├── package.json └── server.js ├── ember ├── .eslintrc.json ├── .gitignore ├── README.md ├── client │ ├── .editorconfig │ ├── .ember-cli │ ├── .eslintignore │ ├── .eslintrc.js │ ├── .gitignore │ ├── .template-lintrc.js │ ├── .watchmanconfig │ ├── README.md │ ├── app │ │ ├── app.js │ │ ├── controllers │ │ │ ├── .gitkeep │ │ │ └── application.js │ │ ├── index.html │ │ ├── resolver.js │ │ ├── router.js │ │ ├── styles │ │ │ └── app.css │ │ └── templates │ │ │ └── application.hbs │ ├── config │ │ ├── environment.js │ │ ├── optional-features.json │ │ └── targets.js │ ├── ember-cli-build.js │ ├── package-lock.json │ ├── package.json │ ├── public │ │ └── robots.txt │ └── tests │ │ ├── helpers │ │ └── .gitkeep │ │ ├── index.html │ │ ├── integration │ │ └── .gitkeep │ │ ├── test-helper.js │ │ └── unit │ │ └── .gitkeep ├── package-lock.json ├── package.json ├── server.js └── start-client.js ├── jquery ├── .eslintrc.json ├── .gitignore ├── README.md ├── app.js ├── index.html ├── index.js ├── package-lock.json └── package.json ├── more-examples ├── database-timeout │ ├── README.md │ ├── index.js │ ├── package-lock.json │ ├── package.json │ └── server.js ├── multiple-express │ ├── README.md │ ├── benchmark │ │ └── index.js │ ├── client.js │ ├── express-end.js │ ├── express-middleman.js │ ├── package-lock.json │ └── package.json └── typescript-example │ ├── package-lock.json │ ├── package.json │ ├── src │ └── index.ts │ └── tsconfig.json ├── prometheus ├── .gitignore ├── .nodeshift │ └── deplyoment.yml ├── README.md ├── package-lock.json ├── package.json ├── scripts │ ├── alertmanager.yml │ ├── bench-test.sh │ ├── bench-test2.sh │ ├── bench-test3.sh │ ├── bench-test4.sh │ ├── deploy-app.sh │ ├── get-app-url.sh │ ├── install-prometheus.sh │ ├── minishift-start.sh │ └── prometheus.yml └── src │ └── app.js ├── react ├── README.md ├── client │ ├── .gitignore │ ├── .prettierrc │ ├── package-lock.json │ ├── package.json │ ├── public │ │ ├── favicon.ico │ │ ├── index.html │ │ ├── logo192.png │ │ ├── logo512.png │ │ ├── manifest.json │ │ └── robots.txt │ └── src │ │ ├── App.css │ │ ├── App.js │ │ └── index.js ├── images │ ├── react-browser.png │ └── react-terminal.png ├── package-lock.json ├── package.json └── server.js ├── seneca ├── README.md ├── app.js ├── index.html ├── index.js ├── package-lock.json ├── package.json └── service.js ├── svelte ├── README.md ├── client │ ├── .gitignore │ ├── README.md │ ├── package-lock.json │ ├── package.json │ ├── public │ │ ├── favicon.png │ │ ├── global.css │ │ └── index.html │ ├── rollup.config.js │ ├── scripts │ │ └── setupTypeScript.js │ └── src │ │ ├── App.svelte │ │ └── main.js ├── images │ ├── svelte-browser.png │ └── svelte-terminal.png ├── package-lock.json ├── package.json └── server.js └── vue ├── README.md ├── client ├── .browserslistrc ├── .gitignore ├── .prettierrc ├── README.md ├── babel.config.js ├── package-lock.json ├── package.json ├── public │ ├── favicon.ico │ └── index.html └── src │ ├── App.vue │ └── main.js ├── images ├── vue-browser.png └── vue-terminal.png ├── package-lock.json ├── package.json └── server.js /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | 3 | # Mac OS 4 | .DS_Store -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright Red Hat, Inc. 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 4 | 5 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 6 | 7 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 8 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # opossum examples 2 | 3 | This repository contains a few examples for the https://github.com/nodeshift/opossum circuit breaker. 4 | -------------------------------------------------------------------------------- /angular/README.md: -------------------------------------------------------------------------------- 1 | # Angular Example 2 | 3 | This example exposes a simple service at the route `http://localhost:3000/flakeyService`. 4 | For every request the service receives, the response time is increased. 5 | [The service returns a `423 (Locked)` error if the response time is above 1000ms.](https://github.com/nodeshift-starters/opossum-examples/blob/main/angular9/server.js#L27) This example also has a web frontend at `http://localhost:4200/` for interacting with the service. 6 | 7 | 1. Install Angular CLI 8 | 9 | ```sh 10 | $ npm install -g @angular/cli 11 | ``` 12 | 13 | 2. Install dependencies 14 | 15 | ```sh 16 | $ npm install && cd client/ && npm install && cd .. 17 | ``` 18 | 19 | 3. Run the example 20 | 21 | This example uses the [concurrently](https://www.npmjs.com/package/concurrently) npm module to run the server and the client at the same time. 22 | 23 | ```sh 24 | $ npm start 25 | ``` 26 | 27 |
10 | This app demonstrates usage of the opossum
11 | circuit breaker in Angular applications.
12 |
15 | The application calls a flakey web service that takes longer and longer 16 | to respond. The circuit breaker is configured to timeout after 500ms and 17 | execute a fallback command. Every 20 seconds, the flakey service is reset 18 | and the pattern is repeated. 19 |
20 |