{"action":"created","comment":{"url":"https://api.github.com/repos/allegro/hermes/pulls/comments/47621197","id":47621197,"diff_hunk":"@@ -55,7 +50,29 @@ UnwrappedMessageContent unwrapContent(byte[] data, Schema schema) {\n         return builder.build();\n     }\n \n+    private long getTimestamp(Map<Utf8, Utf8> metadata) {\n+        return metadata != null && metadata.containsKey(METADATA_TIMESTAMP_KEY) ? timestampFromMetadata(metadata) :\n+                System.currentTimeMillis();\n+    }\n+\n+    private long timestampFromMetadata(Map<Utf8, Utf8> metadata) {\n+        return Long.parseLong(metadata.remove(METADATA_TIMESTAMP_KEY).toString());\n+    }\n+\n+    private String getMessageId(Map<Utf8, Utf8> metadata, long timestamp) {\n+        return metadata != null && metadata.containsKey(METADATA_MESSAGE_ID_KEY) ? messageIdFromMetadata(metadata) :\n+                MessageId.forTimestamp(timestamp);\n+    }\n+\n+    private String messageIdFromMetadata(Map<Utf8, Utf8> metadata) {\n+        return metadata.remove(METADATA_MESSAGE_ID_KEY).toString();\n+    }\n+\n     private static Map<String, String> extractMetadata(Map<Utf8, Utf8> metadata) {","path":"hermes-common/src/main/java/pl/allegro/tech/hermes/common/message/wrapper/AvroMessageContentWrapper.java","position":61,"original_position":61,"commit_id":"b4ab9496cb89f584dace687abb3caa0130345d56","original_commit_id":"b4ab9496cb89f584dace687abb3caa0130345d56","user":{"login":"wojtkiewicz","id":11539876,"avatar_url":"https://avatars.githubusercontent.com/u/11539876?v=3","gravatar_id":"","url":"https://api.github.com/users/wojtkiewicz","html_url":"https://github.com/wojtkiewicz","followers_url":"https://api.github.com/users/wojtkiewicz/followers","following_url":"https://api.github.com/users/wojtkiewicz/following{/other_user}","gists_url":"https://api.github.com/users/wojtkiewicz/gists{/gist_id}","starred_url":"https://api.github.com/users/wojtkiewicz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wojtkiewicz/subscriptions","organizations_url":"https://api.github.com/users/wojtkiewicz/orgs","repos_url":"https://api.github.com/users/wojtkiewicz/repos","events_url":"https://api.github.com/users/wojtkiewicz/events{/privacy}","received_events_url":"https://api.github.com/users/wojtkiewicz/received_events","type":"User","site_admin":false},"body":"you can express body of this function as:\r\n\r\n``` \r\nreturn Optional.fromNullable(metadata).or(Collections.EMPTY_MAP)\r\n                .entrySet().stream()\r\n                .collect(Collectors.toMap(\r\n                        entry -> entry.getKey().toString(),\r\n                        entry -> entry.getValue().toString()\r\n                );\r\n```\r\n","created_at":"2015-12-15T10:46:28Z","updated_at":"2015-12-15T10:46:28Z","html_url":"https://github.com/allegro/hermes/pull/273#discussion_r47621197","pull_request_url":"https://api.github.com/repos/allegro/hermes/pulls/273","_links":{"self":{"href":"https://api.github.com/repos/allegro/hermes/pulls/comments/47621197"},"html":{"href":"https://github.com/allegro/hermes/pull/273#discussion_r47621197"},"pull_request":{"href":"https://api.github.com/repos/allegro/hermes/pulls/273"}}},"pull_request":{"url":"https://api.github.com/repos/allegro/hermes/pulls/273","id":53682069,"html_url":"https://github.com/allegro/hermes/pull/273","diff_url":"https://github.com/allegro/hermes/pull/273.diff","patch_url":"https://github.com/allegro/hermes/pull/273.patch","issue_url":"https://api.github.com/repos/allegro/hermes/issues/273","number":273,"state":"open","locked":false,"title":"SKYLAB-264 introduce possibility to provide custom KafkaNamesMapper","user":{"login":"pawelszymczyk","id":6159409,"avatar_url":"https://avatars.githubusercontent.com/u/6159409?v=3","gravatar_id":"","url":"https://api.github.com/users/pawelszymczyk","html_url":"https://github.com/pawelszymczyk","followers_url":"https://api.github.com/users/pawelszymczyk/followers","following_url":"https://api.github.com/users/pawelszymczyk/following{/other_user}","gists_url":"https://api.github.com/users/pawelszymczyk/gists{/gist_id}","starred_url":"https://api.github.com/users/pawelszymczyk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pawelszymczyk/subscriptions","organizations_url":"https://api.github.com/users/pawelszymczyk/orgs","repos_url":"https://api.github.com/users/pawelszymczyk/repos","events_url":"https://api.github.com/users/pawelszymczyk/events{/privacy}","received_events_url":"https://api.github.com/users/pawelszymczyk/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-12-15T10:02:36Z","updated_at":"2015-12-15T10:46:28Z","closed_at":null,"merged_at":null,"merge_commit_sha":"fedda511f09664f775a9cb5ccf96084015e49336","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/allegro/hermes/pulls/273/commits","review_comments_url":"https://api.github.com/repos/allegro/hermes/pulls/273/comments","review_comment_url":"https://api.github.com/repos/allegro/hermes/pulls/comments{/number}","comments_url":"https://api.github.com/repos/allegro/hermes/issues/273/comments","statuses_url":"https://api.github.com/repos/allegro/hermes/statuses/b4ab9496cb89f584dace687abb3caa0130345d56","head":{"label":"allegro:264-externalize_1_n_mapping-rebased","ref":"264-externalize_1_n_mapping-rebased","sha":"b4ab9496cb89f584dace687abb3caa0130345d56","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}","created_at":"2015-05-15T08:11:16Z","updated_at":"2015-12-14T20:30:08Z","pushed_at":"2015-12-15T10:02:36Z","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":2739,"stargazers_count":145,"watchers_count":145,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":19,"mirror_url":null,"open_issues_count":20,"forks":19,"open_issues":20,"watchers":145,"default_branch":"master"}},"base":{"label":"allegro:rc","ref":"rc","sha":"7587929f6f8d4f32597a0bdbe2cd6b25ff902bcd","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}","created_at":"2015-05-15T08:11:16Z","updated_at":"2015-12-14T20:30:08Z","pushed_at":"2015-12-15T10:02:36Z","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":2739,"stargazers_count":145,"watchers_count":145,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":19,"mirror_url":null,"open_issues_count":20,"forks":19,"open_issues":20,"watchers":145,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/allegro/hermes/pulls/273"},"html":{"href":"https://github.com/allegro/hermes/pull/273"},"issue":{"href":"https://api.github.com/repos/allegro/hermes/issues/273"},"comments":{"href":"https://api.github.com/repos/allegro/hermes/issues/273/comments"},"review_comments":{"href":"https://api.github.com/repos/allegro/hermes/pulls/273/comments"},"review_comment":{"href":"https://api.github.com/repos/allegro/hermes/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/allegro/hermes/pulls/273/commits"},"statuses":{"href":"https://api.github.com/repos/allegro/hermes/statuses/b4ab9496cb89f584dace687abb3caa0130345d56"}}}}