{"id":24360597,"url":"https://github.com/cmccarthyirl/retryaspect","last_synced_at":"2026-06-04T19:31:17.481Z","repository":{"id":244612764,"uuid":"815620004","full_name":"cmccarthyIrl/RetryAspect","owner":"cmccarthyIrl","description":"RetryAspect is a lightweight Java library for adding automatic retry functionality to methods without using Spring. Easily integrate retry logic into your applications for handling transient errors","archived":false,"fork":false,"pushed_at":"2025-12-02T21:24:06.000Z","size":24,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-12-05T20:52:58.848Z","etag":null,"topics":["annotations","aop","aspect-oriented-programming","aspectj","error-handling","java","java-library","retry","retry-logic","weaving"],"latest_commit_sha":null,"homepage":"https://central.sonatype.com/artifact/io.github.cmccarthyirl/retryaspect","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cmccarthyIrl.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","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,"publiccode":null,"codemeta":null}},"created_at":"2024-06-15T16:21:15.000Z","updated_at":"2025-12-02T21:30:52.000Z","dependencies_parsed_at":"2024-06-22T03:10:05.640Z","dependency_job_id":null,"html_url":"https://github.com/cmccarthyIrl/RetryAspect","commit_stats":null,"previous_names":["cmccarthyirl/retryanalyzer","cmccarthyirl/retryaspect"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/cmccarthyIrl/RetryAspect","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cmccarthyIrl%2FRetryAspect","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cmccarthyIrl%2FRetryAspect/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cmccarthyIrl%2FRetryAspect/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cmccarthyIrl%2FRetryAspect/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cmccarthyIrl","download_url":"https://codeload.github.com/cmccarthyIrl/RetryAspect/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cmccarthyIrl%2FRetryAspect/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33917183,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-04T02:00:06.755Z","response_time":64,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["annotations","aop","aspect-oriented-programming","aspectj","error-handling","java","java-library","retry","retry-logic","weaving"],"created_at":"2025-01-18T21:31:51.831Z","updated_at":"2026-06-04T19:31:17.472Z","avatar_url":"https://github.com/cmccarthyIrl.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# RetryAspect\n\nThis `RetryAspect` class is an implementation of the retry mechanism in Java using Aspect-Oriented Programming (AOP). It\nallows methods annotated with `@Retryable` to be executed multiple times in case of failure, with configurable retry\nattempts and backoff delay.\n\n## Features\n\n- **Retry Mechanism**: Automatically retries a method execution if it fails, based on the configuration provided by\n  the `@Retryable` annotation.\n- **Configurable Attempts and Delay**: Allows configuration of the maximum number of retry attempts and the delay\n  between retries.\n- **Exception Handling**: Only retries for specified exceptions, providing fine-grained control over which failures\n  should trigger a retry.\n\n## Usage\n\nTo use the `RetryAspect` class, follow these steps:\n\n### 1. Annotate Methods with `@Retryable`\n\nAnnotate the methods you want to be retryable with the `@Retryable` annotation.\n\n```java\npublic class MyService {\n    @Retryable(maxAttempts = 3, backoff = @Backoff(delay = 1000), include = {RuntimeException.class})\n    public void performTask() {\n        // Method implementation\n    }\n}\n```\n\nIn this example, `performTask` will make up to `3` total attempts (1 initial + 2 retries) with a delay of `1000` milliseconds between retries,\nbut only if a `RuntimeException` is thrown.\n\n**Note:** Methods should be idempotent as they may be executed multiple times.\n\n### 2. Configure the `@Retryable` Annotation\n\nThe `@Retryable` annotation allows you to configure the retry behavior for a method. It has the following attributes:\n\n- **maxAttempts**: The maximum number of retry attempts (default is 3).\n- **backoff**: Specifies the backoff policy, including the delay between retries.\n- **include**: The exceptions that should trigger a retry.\n\n```java\n\n@Retryable(maxAttempts = 5, backoff = @Backoff(delay = 2000), include = {IOException.class})\npublic void unreliableMethod() {\n// Method implementation\n}\n```\n\nIn this example, `unreliableMethod` will make up to `5` total attempts (1 initial + 4 retries) with a delay of `2000` milliseconds between retries,\nbut only if an `IOException` is thrown.\n\n### Important Configuration Notes\n\n- **maxAttempts**: Must be at least 1. Represents total attempts (initial + retries)\n- **include**: Cannot be empty. Must specify at least one exception type to retry\n- **delay**: Must be non-negative (in milliseconds)\n- **multiplier**: Use values \u003e 1.0 for exponential backoff, 1.0 for fixed delay\n\n## Usage\n\nTo use the RetryAspect library in your project, include the following dependencies and plugins in your `pom.xml` file:\n\n1. Add `retryaspect` as a dependency\n\n```xml\n\n\u003cdependencies\u003e\n    ...\n    \u003cdependency\u003e\n        \u003cgroupId\u003eio.github.cmccarthyirl\u003c/groupId\u003e\n        \u003cartifactId\u003eretryaspect\u003c/artifactId\u003e\n        \u003cversion\u003e1.0.5\u003c/version\u003e\n    \u003c/dependency\u003e\n    ...\n\u003c/dependencies\u003e\n```\n\n2. Configure the AspectJ Maven Plugin\n\n```xml\n\n\u003cbuild\u003e\n    \u003cplugins\u003e\n        \u003cplugin\u003e\n            \u003cgroupId\u003eorg.codehaus.mojo\u003c/groupId\u003e\n            \u003cartifactId\u003easpectj-maven-plugin\u003c/artifactId\u003e\n            \u003cversion\u003e1.15.0\u003c/version\u003e\n            \u003cconfiguration\u003e\n                \u003ccomplianceLevel\u003e16.0\u003c/complianceLevel\u003e\n                \u003csource\u003e16.0\u003c/source\u003e\n                \u003ctarget\u003e16.0\u003c/target\u003e\n                \u003cshowWeaveInfo\u003etrue\u003c/showWeaveInfo\u003e\n                \u003cverbose\u003etrue\u003c/verbose\u003e\n                \u003cXlint\u003eignore\u003c/Xlint\u003e\n                \u003cencoding\u003eUTF-8\u003c/encoding\u003e\n                \u003caspectLibraries\u003e\n                    \u003caspectLibrary\u003e\n                        \u003cgroupId\u003eio.github.cmccarthyirl\u003c/groupId\u003e\n                        \u003cartifactId\u003eretryaspect\u003c/artifactId\u003e\n                    \u003c/aspectLibrary\u003e\n                \u003c/aspectLibraries\u003e\n            \u003c/configuration\u003e\n            \u003cexecutions\u003e\n                \u003cexecution\u003e\n                    \u003cgoals\u003e\n                        \u003c!-- use this goal to weave all your main classes --\u003e\n                        \u003cgoal\u003ecompile\u003c/goal\u003e\n                        \u003c!-- use this goal to weave all your test classes --\u003e\n                        \u003cgoal\u003etest-compile\u003c/goal\u003e\n                    \u003c/goals\u003e\n                \u003c/execution\u003e\n            \u003c/executions\u003e\n        \u003c/plugin\u003e\n    \u003c/plugins\u003e\n\u003c/build\u003e\n```\n\n## Contribute\n\nContributions are welcome! [Here's](https://github.com/cmccarthyIrl/RetryAspect/blob/master/CONTRIBUTING.md) how you can get started!!\n\n## License\n\nThis project is licensed under the Apache License 2.0 - see the [LICENSE](https://github.com/cmccarthyIrl/RetryAspect/blob/master/LICENSE) file for details.\n\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcmccarthyirl%2Fretryaspect","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcmccarthyirl%2Fretryaspect","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcmccarthyirl%2Fretryaspect/lists"}