{"action":"created","comment":{"url":"https://api.github.com/repos/allegro/hermes/pulls/comments/79143221","id":79143221,"diff_hunk":"@@ -1,42 +1,67 @@\n package pl.allegro.tech.hermes.client;\n \n+import net.jodah.failsafe.Failsafe;\n+import net.jodah.failsafe.RetryPolicy;\n+\n import java.net.URI;\n import java.util.Collections;\n import java.util.HashMap;\n import java.util.Map;\n import java.util.concurrent.CompletableFuture;\n-import java.util.concurrent.CompletionStage;\n import java.util.concurrent.ExecutionException;\n+import java.util.concurrent.Executors;\n+import java.util.concurrent.ScheduledExecutorService;\n import java.util.concurrent.TimeUnit;\n import java.util.concurrent.TimeoutException;\n import java.util.concurrent.atomic.AtomicInteger;\n-import java.util.function.Function;\n import java.util.function.Predicate;\n \n-import static java.util.concurrent.CompletableFuture.completedFuture;\n-import static java.util.stream.IntStream.range;\n import static pl.allegro.tech.hermes.client.HermesMessage.hermesMessage;\n \n public class HermesClient {\n \n     private final HermesSender sender;\n     private final String uri;\n     private final Map<String, String> defaultHeaders;\n-    private final int retries;\n-    private final Predicate<HermesResponse> retryCondition;\n     private final AtomicInteger currentlySending = new AtomicInteger(0);\n+    private final RetryPolicy retryPolicy;\n+    private final ScheduledExecutorService scheduler;\n     private volatile boolean shutdown = false;\n \n     HermesClient(HermesSender sender,\n                  URI uri,\n                  Map<String, String> defaultHeaders,\n                  int retries,\n-                 Predicate<HermesResponse> retryCondition) {\n+                 Predicate<HermesResponse> retryCondition,\n+                 long retrySleepInMillis,\n+                 long maxRetrySleepInMillis) {\n+        this(sender, uri, defaultHeaders, retries, retryCondition, retrySleepInMillis,","path":"hermes-client/src/main/java/pl/allegro/tech/hermes/client/HermesClient.java","position":45,"original_position":45,"commit_id":"d5299660fcedc32b953383e82529c213ca5f8aa6","original_commit_id":"d5299660fcedc32b953383e82529c213ca5f8aa6","user":{"login":"aihnat","id":9904764,"avatar_url":"https://avatars.githubusercontent.com/u/9904764?v=3","gravatar_id":"","url":"https://api.github.com/users/aihnat","html_url":"https://github.com/aihnat","followers_url":"https://api.github.com/users/aihnat/followers","following_url":"https://api.github.com/users/aihnat/following{/other_user}","gists_url":"https://api.github.com/users/aihnat/gists{/gist_id}","starred_url":"https://api.github.com/users/aihnat/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aihnat/subscriptions","organizations_url":"https://api.github.com/users/aihnat/orgs","repos_url":"https://api.github.com/users/aihnat/repos","events_url":"https://api.github.com/users/aihnat/events{/privacy}","received_events_url":"https://api.github.com/users/aihnat/received_events","type":"User","site_admin":false},"body":"Ok. Deleted. I thought it would be better to leave existing constructor in case someone use it.","created_at":"2016-09-16T10:25:11Z","updated_at":"2016-09-16T10:25:11Z","html_url":"https://github.com/allegro/hermes/pull/577#discussion_r79143221","pull_request_url":"https://api.github.com/repos/allegro/hermes/pulls/577","_links":{"self":{"href":"https://api.github.com/repos/allegro/hermes/pulls/comments/79143221"},"html":{"href":"https://github.com/allegro/hermes/pull/577#discussion_r79143221"},"pull_request":{"href":"https://api.github.com/repos/allegro/hermes/pulls/577"}}},"pull_request":{"url":"https://api.github.com/repos/allegro/hermes/pulls/577","id":85413178,"html_url":"https://github.com/allegro/hermes/pull/577","diff_url":"https://github.com/allegro/hermes/pull/577.diff","patch_url":"https://github.com/allegro/hermes/pull/577.patch","issue_url":"https://api.github.com/repos/allegro/hermes/issues/577","number":577,"state":"open","locked":false,"title":"(Resolving #481) adding exponential delay between retries","user":{"login":"aihnat","id":9904764,"avatar_url":"https://avatars.githubusercontent.com/u/9904764?v=3","gravatar_id":"","url":"https://api.github.com/users/aihnat","html_url":"https://github.com/aihnat","followers_url":"https://api.github.com/users/aihnat/followers","following_url":"https://api.github.com/users/aihnat/following{/other_user}","gists_url":"https://api.github.com/users/aihnat/gists{/gist_id}","starred_url":"https://api.github.com/users/aihnat/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aihnat/subscriptions","organizations_url":"https://api.github.com/users/aihnat/orgs","repos_url":"https://api.github.com/users/aihnat/repos","events_url":"https://api.github.com/users/aihnat/events{/privacy}","received_events_url":"https://api.github.com/users/aihnat/received_events","type":"User","site_admin":false},"body":"I used external library failsafe (https://github.com/jhalterman/failsafe)","created_at":"2016-09-15T14:19:13Z","updated_at":"2016-09-16T10:25:11Z","closed_at":null,"merged_at":null,"merge_commit_sha":"42fe0dda76a16cf480a3956f2e63558ff01a3e3b","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/allegro/hermes/pulls/577/commits","review_comments_url":"https://api.github.com/repos/allegro/hermes/pulls/577/comments","review_comment_url":"https://api.github.com/repos/allegro/hermes/pulls/comments{/number}","comments_url":"https://api.github.com/repos/allegro/hermes/issues/577/comments","statuses_url":"https://api.github.com/repos/allegro/hermes/statuses/d5299660fcedc32b953383e82529c213ca5f8aa6","head":{"label":"aihnat:481_add_retries_delays_in_client","ref":"481_add_retries_delays_in_client","sha":"d5299660fcedc32b953383e82529c213ca5f8aa6","user":{"login":"aihnat","id":9904764,"avatar_url":"https://avatars.githubusercontent.com/u/9904764?v=3","gravatar_id":"","url":"https://api.github.com/users/aihnat","html_url":"https://github.com/aihnat","followers_url":"https://api.github.com/users/aihnat/followers","following_url":"https://api.github.com/users/aihnat/following{/other_user}","gists_url":"https://api.github.com/users/aihnat/gists{/gist_id}","starred_url":"https://api.github.com/users/aihnat/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aihnat/subscriptions","organizations_url":"https://api.github.com/users/aihnat/orgs","repos_url":"https://api.github.com/users/aihnat/repos","events_url":"https://api.github.com/users/aihnat/events{/privacy}","received_events_url":"https://api.github.com/users/aihnat/received_events","type":"User","site_admin":false},"repo":{"id":68091425,"name":"hermes","full_name":"aihnat/hermes","owner":{"login":"aihnat","id":9904764,"avatar_url":"https://avatars.githubusercontent.com/u/9904764?v=3","gravatar_id":"","url":"https://api.github.com/users/aihnat","html_url":"https://github.com/aihnat","followers_url":"https://api.github.com/users/aihnat/followers","following_url":"https://api.github.com/users/aihnat/following{/other_user}","gists_url":"https://api.github.com/users/aihnat/gists{/gist_id}","starred_url":"https://api.github.com/users/aihnat/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aihnat/subscriptions","organizations_url":"https://api.github.com/users/aihnat/orgs","repos_url":"https://api.github.com/users/aihnat/repos","events_url":"https://api.github.com/users/aihnat/events{/privacy}","received_events_url":"https://api.github.com/users/aihnat/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/aihnat/hermes","description":"Fast and reliable message broker built on top of Kafka.","fork":true,"url":"https://api.github.com/repos/aihnat/hermes","forks_url":"https://api.github.com/repos/aihnat/hermes/forks","keys_url":"https://api.github.com/repos/aihnat/hermes/keys{/key_id}","collaborators_url":"https://api.github.com/repos/aihnat/hermes/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/aihnat/hermes/teams","hooks_url":"https://api.github.com/repos/aihnat/hermes/hooks","issue_events_url":"https://api.github.com/repos/aihnat/hermes/issues/events{/number}","events_url":"https://api.github.com/repos/aihnat/hermes/events","assignees_url":"https://api.github.com/repos/aihnat/hermes/assignees{/user}","branches_url":"https://api.github.com/repos/aihnat/hermes/branches{/branch}","tags_url":"https://api.github.com/repos/aihnat/hermes/tags","blobs_url":"https://api.github.com/repos/aihnat/hermes/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/aihnat/hermes/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/aihnat/hermes/git/refs{/sha}","trees_url":"https://api.github.com/repos/aihnat/hermes/git/trees{/sha}","statuses_url":"https://api.github.com/repos/aihnat/hermes/statuses/{sha}","languages_url":"https://api.github.com/repos/aihnat/hermes/languages","stargazers_url":"https://api.github.com/repos/aihnat/hermes/stargazers","contributors_url":"https://api.github.com/repos/aihnat/hermes/contributors","subscribers_url":"https://api.github.com/repos/aihnat/hermes/subscribers","subscription_url":"https://api.github.com/repos/aihnat/hermes/subscription","commits_url":"https://api.github.com/repos/aihnat/hermes/commits{/sha}","git_commits_url":"https://api.github.com/repos/aihnat/hermes/git/commits{/sha}","comments_url":"https://api.github.com/repos/aihnat/hermes/comments{/number}","issue_comment_url":"https://api.github.com/repos/aihnat/hermes/issues/comments{/number}","contents_url":"https://api.github.com/repos/aihnat/hermes/contents/{+path}","compare_url":"https://api.github.com/repos/aihnat/hermes/compare/{base}...{head}","merges_url":"https://api.github.com/repos/aihnat/hermes/merges","archive_url":"https://api.github.com/repos/aihnat/hermes/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/aihnat/hermes/downloads","issues_url":"https://api.github.com/repos/aihnat/hermes/issues{/number}","pulls_url":"https://api.github.com/repos/aihnat/hermes/pulls{/number}","milestones_url":"https://api.github.com/repos/aihnat/hermes/milestones{/number}","notifications_url":"https://api.github.com/repos/aihnat/hermes/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/aihnat/hermes/labels{/name}","releases_url":"https://api.github.com/repos/aihnat/hermes/releases{/id}","deployments_url":"https://api.github.com/repos/aihnat/hermes/deployments","created_at":"2016-09-13T08:50:20Z","updated_at":"2016-09-13T08:50:23Z","pushed_at":"2016-09-15T14:24:46Z","git_url":"git://github.com/aihnat/hermes.git","ssh_url":"git@github.com:aihnat/hermes.git","clone_url":"https://github.com/aihnat/hermes.git","svn_url":"https://github.com/aihnat/hermes","homepage":"http://hermes.allegro.tech","size":5004,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"allegro:develop","ref":"develop","sha":"1e238d5be5dc3d464dc8cf23e1d15e0bbb1272ae","user":{"login":"allegro","id":562236,"avatar_url":"https://avatars.githubusercontent.com/u/562236?v=3","gravatar_id":"","url":"https://api.github.com/users/allegro","html_url":"https://github.com/allegro","followers_url":"https://api.github.com/users/allegro/followers","following_url":"https://api.github.com/users/allegro/following{/other_user}","gists_url":"https://api.github.com/users/allegro/gists{/gist_id}","starred_url":"https://api.github.com/users/allegro/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/allegro/subscriptions","organizations_url":"https://api.github.com/users/allegro/orgs","repos_url":"https://api.github.com/users/allegro/repos","events_url":"https://api.github.com/users/allegro/events{/privacy}","received_events_url":"https://api.github.com/users/allegro/received_events","type":"Organization","site_admin":false},"repo":{"id":35662043,"name":"hermes","full_name":"allegro/hermes","owner":{"login":"allegro","id":562236,"avatar_url":"https://avatars.githubusercontent.com/u/562236?v=3","gravatar_id":"","url":"https://api.github.com/users/allegro","html_url":"https://github.com/allegro","followers_url":"https://api.github.com/users/allegro/followers","following_url":"https://api.github.com/users/allegro/following{/other_user}","gists_url":"https://api.github.com/users/allegro/gists{/gist_id}","starred_url":"https://api.github.com/users/allegro/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/allegro/subscriptions","organizations_url":"https://api.github.com/users/allegro/orgs","repos_url":"https://api.github.com/users/allegro/repos","events_url":"https://api.github.com/users/allegro/events{/privacy}","received_events_url":"https://api.github.com/users/allegro/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/allegro/hermes","description":"Fast and reliable message broker built on top of Kafka.","fork":false,"url":"https://api.github.com/repos/allegro/hermes","forks_url":"https://api.github.com/repos/allegro/hermes/forks","keys_url":"https://api.github.com/repos/allegro/hermes/keys{/key_id}","collaborators_url":"https://api.github.com/repos/allegro/hermes/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/allegro/hermes/teams","hooks_url":"https://api.github.com/repos/allegro/hermes/hooks","issue_events_url":"https://api.github.com/repos/allegro/hermes/issues/events{/number}","events_url":"https://api.github.com/repos/allegro/hermes/events","assignees_url":"https://api.github.com/repos/allegro/hermes/assignees{/user}","branches_url":"https://api.github.com/repos/allegro/hermes/branches{/branch}","tags_url":"https://api.github.com/repos/allegro/hermes/tags","blobs_url":"https://api.github.com/repos/allegro/hermes/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/allegro/hermes/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/allegro/hermes/git/refs{/sha}","trees_url":"https://api.github.com/repos/allegro/hermes/git/trees{/sha}","statuses_url":"https://api.github.com/repos/allegro/hermes/statuses/{sha}","languages_url":"https://api.github.com/repos/allegro/hermes/languages","stargazers_url":"https://api.github.com/repos/allegro/hermes/stargazers","contributors_url":"https://api.github.com/repos/allegro/hermes/contributors","subscribers_url":"https://api.github.com/repos/allegro/hermes/subscribers","subscription_url":"https://api.github.com/repos/allegro/hermes/subscription","commits_url":"https://api.github.com/repos/allegro/hermes/commits{/sha}","git_commits_url":"https://api.github.com/repos/allegro/hermes/git/commits{/sha}","comments_url":"https://api.github.com/repos/allegro/hermes/comments{/number}","issue_comment_url":"https://api.github.com/repos/allegro/hermes/issues/comments{/number}","contents_url":"https://api.github.com/repos/allegro/hermes/contents/{+path}","compare_url":"https://api.github.com/repos/allegro/hermes/compare/{base}...{head}","merges_url":"https://api.github.com/repos/allegro/hermes/merges","archive_url":"https://api.github.com/repos/allegro/hermes/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/allegro/hermes/downloads","issues_url":"https://api.github.com/repos/allegro/hermes/issues{/number}","pulls_url":"https://api.github.com/repos/allegro/hermes/pulls{/number}","milestones_url":"https://api.github.com/repos/allegro/hermes/milestones{/number}","notifications_url":"https://api.github.com/repos/allegro/hermes/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/allegro/hermes/labels{/name}","releases_url":"https://api.github.com/repos/allegro/hermes/releases{/id}","deployments_url":"https://api.github.com/repos/allegro/hermes/deployments","created_at":"2015-05-15T08:11:16Z","updated_at":"2016-09-09T12:38:21Z","pushed_at":"2016-09-16T07:34:23Z","git_url":"git://github.com/allegro/hermes.git","ssh_url":"git@github.com:allegro/hermes.git","clone_url":"https://github.com/allegro/hermes.git","svn_url":"https://github.com/allegro/hermes","homepage":"http://hermes.allegro.tech","size":5572,"stargazers_count":196,"watchers_count":196,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":41,"mirror_url":null,"open_issues_count":51,"forks":41,"open_issues":51,"watchers":196,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/allegro/hermes/pulls/577"},"html":{"href":"https://github.com/allegro/hermes/pull/577"},"issue":{"href":"https://api.github.com/repos/allegro/hermes/issues/577"},"comments":{"href":"https://api.github.com/repos/allegro/hermes/issues/577/comments"},"review_comments":{"href":"https://api.github.com/repos/allegro/hermes/pulls/577/comments"},"review_comment":{"href":"https://api.github.com/repos/allegro/hermes/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/allegro/hermes/pulls/577/commits"},"statuses":{"href":"https://api.github.com/repos/allegro/hermes/statuses/d5299660fcedc32b953383e82529c213ca5f8aa6"}}}}
{"actor":{"display_login":"aihnat"}}