{"id":19233869,"url":"https://github.com/hadielmougy/shield","last_synced_at":"2025-04-21T04:33:36.080Z","repository":{"id":170413144,"uuid":"239214843","full_name":"hadielmougy/shield","owner":"hadielmougy","description":"Fault tolerance library for java","archived":false,"fork":false,"pushed_at":"2023-12-03T13:45:11.000Z","size":148,"stargazers_count":7,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2023-12-03T14:31:06.514Z","etag":null,"topics":["circuit-breaker","fault-tolerance","java","rate-limiting","resiliency","retry","throttling","timeout"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hadielmougy.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2020-02-08T22:42:02.000Z","updated_at":"2024-04-14T20:23:34.413Z","dependencies_parsed_at":"2024-04-14T20:23:28.957Z","dependency_job_id":"91b160bc-c008-4b3c-94a8-05dbc938698e","html_url":"https://github.com/hadielmougy/shield","commit_stats":null,"previous_names":["hadielmougy/shield"],"tags_count":0,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hadielmougy%2Fshield","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hadielmougy%2Fshield/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hadielmougy%2Fshield/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hadielmougy%2Fshield/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hadielmougy","download_url":"https://codeload.github.com/hadielmougy/shield/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249996279,"owners_count":21358103,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["circuit-breaker","fault-tolerance","java","rate-limiting","resiliency","retry","throttling","timeout"],"created_at":"2024-11-09T16:12:10.633Z","updated_at":"2025-04-21T04:33:35.641Z","avatar_url":"https://github.com/hadielmougy.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# shield\n\nFault tolerance library for java\n\n## Usage\n\n```xml\n\u003cdependency\u003e\n    \u003cgroupId\u003eio.github.hadielmougy\u003c/groupId\u003e\n    \u003cartifactId\u003eshield\u003c/artifactId\u003e\n    \u003cversion\u003e0.1.2\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\n## Supported Interceptors\n\n### Throttler\n\n```java\n\n    final Supplier\u003cVoid\u003e throttler = Shield.decorate(target)\n        .with(Interceptor.throttler()\n            .requests(1)\n            .maxWaitMillis(500))\n        .build();\n\n   \n```\n### Rate limit\n\n```java\n\n    final Supplier\u003cVoid\u003e limiter = Shield.decorate(target)\n        .with(Interceptor.rateLimiter()\n            .rate(1))\n        .build();\n\n```\n### Timeout\n\n```java\n\n    final Supplier\u003cVoid\u003e decorated = Shield.decorate(target)\n            .with(Interceptor.timeout().waitMillis(1100))\n            .with(Interceptor.retry().delayMillis(1000).maxRetries(5))\n            .build();\n```\n### Retry\n\n```java\n\n    final Retry retry = Interceptor.retry()\n            .delayMillis(500)\n            .maxRetries(3)\n            .onException(IllegalArgumentException.class);\n\n\n```\n### Circuit-breaker\n\n```java\n\n    // count based\n    final Supplier\u003cVoid\u003e comp = Shield.decorate( component)\n                .with(Interceptor.circuitBreaker()\n                        .failureRateThreshold(50)\n                        .slidingWindowSize(4)\n                        .waitDurationInOpenState(Duration.ofSeconds(1))\n                        .slidingWindowType(CircuitBreaker.WindowType.COUNT_BASED))\n                .build();\n\n    // time based\n    final Supplier\u003cVoid\u003e comp = Shield.decorate(target)\n                .with(Interceptor.circuitBreaker()\n                        .failureRateThreshold(50)\n                        .slidingWindowSize(1)\n                        .waitDurationInOpenState(Duration.ofSeconds(1))\n                        .slidingWindowType(CircuitBreaker.WindowType.TIME_BASED))\n                .build();\n\n```\n\n### Assemble\n\n```java\n\n    final Supplier\u003cVoid\u003e decorated = Shield.decorate(() -\u003e ...)\n            .with(retry)\n            .with(...)\n            .build();\n    \n    decorated.get();\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhadielmougy%2Fshield","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhadielmougy%2Fshield","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhadielmougy%2Fshield/lists"}