{"action":"created","issue":{"url":"https://api.github.com/repos/jhalterman/failsafe/issues/36","repository_url":"https://api.github.com/repos/jhalterman/failsafe","labels_url":"https://api.github.com/repos/jhalterman/failsafe/issues/36/labels{/name}","comments_url":"https://api.github.com/repos/jhalterman/failsafe/issues/36/comments","events_url":"https://api.github.com/repos/jhalterman/failsafe/issues/36/events","html_url":"https://github.com/jhalterman/failsafe/issues/36","id":167051310,"number":36,"title":"Listeners not working?","user":{"login":"BenRomberg","id":1444621,"avatar_url":"https://avatars.githubusercontent.com/u/1444621?v=3","gravatar_id":"","url":"https://api.github.com/users/BenRomberg","html_url":"https://github.com/BenRomberg","followers_url":"https://api.github.com/users/BenRomberg/followers","following_url":"https://api.github.com/users/BenRomberg/following{/other_user}","gists_url":"https://api.github.com/users/BenRomberg/gists{/gist_id}","starred_url":"https://api.github.com/users/BenRomberg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BenRomberg/subscriptions","organizations_url":"https://api.github.com/users/BenRomberg/orgs","repos_url":"https://api.github.com/users/BenRomberg/repos","events_url":"https://api.github.com/users/BenRomberg/events{/privacy}","received_events_url":"https://api.github.com/users/BenRomberg/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/jhalterman/failsafe/labels/bug","name":"bug","color":"fc2929"}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-07-22T13:58:51Z","updated_at":"2016-07-23T10:02:05Z","closed_at":null,"body":"First of all, great framework! Lightweight, super simple to use, yet feature-rich. Enjoying it so far!\r\n\r\nSadly I can't get Listeners to work. Trying the `onRetry` and `onFailedAttempt` Listeners with more than one argument, with the `retryIf` condition failing. Some code:\r\n\r\n```\r\n    private static final RetryPolicy RETRY_POLICY = new RetryPolicy()\r\n            .retryIf((CachedResponse response) -> response == null || response.getStatusFamily() != Family.SUCCESSFUL)\r\n            .retryOn(Exception.class).withDelay(3, TimeUnit.SECONDS).withMaxRetries(3);\r\n// ...\r\nCachedResponse response = Failsafe.<Response> with(RETRY_POLICY)\r\n                .onFailedAttempt((failedResponse, exception, context) -> {\r\n                    System.err.println(\"response: \" + failedResponse);\r\n                    System.err.println(\"exception: \" + exception);\r\n                    }).get(() -> new CachedResponse(target.request().get()));\r\n```\r\n\r\nSome scenarios that I expect to work vs. the ones that actually work:\r\n- [ ] Response fails (i.e. `retryIf` condition fails) with 3 arguments `onFailedAttempt` / `onRetry`\r\n- [ ] Response fails (i.e. `retryIf` condition fails) with 2 arguments `onFailedAttempt` / `onRetry`\r\n- [x] Response fails (i.e. `retryIf` condition fails) with 1 argument `onFailedAttempt` / `onRetry` (but argument `failure` is always `null`, which is correct but not helpful)\r\n- [x] Failure (i.e. `retryOn` condition fails) with 3 arguments `onFailedAttempt` / `onRetry`\r\n- [x] Failure (i.e. `retryOn` condition fails) with 2 arguments `onFailedAttempt` / `onRetry`\r\n- [x] Failure (i.e. `retryOn` condition fails) with 1 argument `onFailedAttempt` / `onRetry`\r\n\r\nLet me know if you can reproduce it or if I'm doing something wrong on my side. Thanks!"},"comment":{"url":"https://api.github.com/repos/jhalterman/failsafe/issues/comments/234710360","html_url":"https://github.com/jhalterman/failsafe/issues/36#issuecomment-234710360","issue_url":"https://api.github.com/repos/jhalterman/failsafe/issues/36","id":234710360,"user":{"login":"BenRomberg","id":1444621,"avatar_url":"https://avatars.githubusercontent.com/u/1444621?v=3","gravatar_id":"","url":"https://api.github.com/users/BenRomberg","html_url":"https://github.com/BenRomberg","followers_url":"https://api.github.com/users/BenRomberg/followers","following_url":"https://api.github.com/users/BenRomberg/following{/other_user}","gists_url":"https://api.github.com/users/BenRomberg/gists{/gist_id}","starred_url":"https://api.github.com/users/BenRomberg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BenRomberg/subscriptions","organizations_url":"https://api.github.com/users/BenRomberg/orgs","repos_url":"https://api.github.com/users/BenRomberg/repos","events_url":"https://api.github.com/users/BenRomberg/events{/privacy}","received_events_url":"https://api.github.com/users/BenRomberg/received_events","type":"User","site_admin":false},"created_at":"2016-07-23T10:02:05Z","updated_at":"2016-07-23T10:02:05Z","body":"The problem I had was that the listener was not called at all in the 2 scenarios I described above, even though there were 3 failing retries.\r\n\r\nI'll try out `master` once I get to it, probably by the end of next week (it's for a side project I only work on Fridays). If it still doesn't work, I'll provide a failing test that highlights the issue. Thanks for the prompt response!"}}
{"actor":{"display_login":"BenRomberg"}}