{"action":"created","comment":{"url":"https://api.github.com/repos/esbtools/esb-message-admin/pulls/comments/26684916","id":26684916,"diff_hunk":"@@ -290,9 +303,55 @@ private MetadataField searchField(MetadataField tree, MetadataField field) {\n     }\n \n     @Override\n-    public void sync(String entity, String system, String key, String... values) {\n-        // TODO Auto-generated method stub\n+    public MetadataResponse sync(String entity, String system, String key, String... values) {\n \n+        MetadataResponse result = new MetadataResponse();\n+        // create JMS Payload\n+        StringBuilder message = new StringBuilder(\"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?>\");\n+        message.append(\"<SyncRequest><EntityName>\");\n+        message.append(entity);\n+        message.append(\"</EntityName><KeyName>\");\n+        message.append(key);\n+        message.append(\"</KeyName>\");\n+        for(String value: values) {\n+            if(value!=null && value.length()>0) {\n+                message.append(\"<KeyValue>\");\n+                message.append(value);\n+                message.append(\"</KeyValue>\");\n+            }\n+        }\n+        message.append(\"</SyncRequest>\");\n+        log.log(Level.INFO, \"Initiating sync request:\"+message.toString());\n+\n+        boolean foundActiveHost = false;\n+        for(String restEndPoint: resyncRestEndpoints) {\n+\n+            try {\n+                URL url = new URL(restEndPoint);\n+                HttpURLConnection conn = (HttpURLConnection) url.openConnection();\n+                conn.setDoOutput(true);\n+                conn.setRequestMethod(\"POST\");\n+                conn.setRequestProperty(\"Content-Type\", \"application/xml\");\n+                OutputStream os = conn.getOutputStream();\n+                os.write(message.toString().getBytes());\n+                os.flush();\n+                if (conn.getResponseCode() == HttpURLConnection.HTTP_OK) {\n+                    foundActiveHost = true;\n+                    break;\n+                } else {\n+                    log.warning(\"unable to send resync message to:\"+restEndPoint);\n+                }\n+                conn.disconnect();\n+            } catch (MalformedURLException e) {\n+                result.setErrorMessage(e.getMessage());\n+            } catch (IOException e) {\n+                result.setErrorMessage(e.getMessage());\n+            }\n+        }\n+        if(!foundActiveHost && result.getStatus()==MetadataResponse.Status.Success) {","path":"common/src/main/java/org/esbtools/message/admin/common/dao/MetadataDAOImpl.java","position":92,"original_position":92,"commit_id":"9577d7186495da5de5841abaec18a9af74f4bd66","original_commit_id":"fa4670ea6c2839da0c41348b4d6fc0801de64bf4","user":{"login":"vritant","id":2501280,"avatar_url":"https://avatars.githubusercontent.com/u/2501280?v=3","gravatar_id":"","url":"https://api.github.com/users/vritant","html_url":"https://github.com/vritant","followers_url":"https://api.github.com/users/vritant/followers","following_url":"https://api.github.com/users/vritant/following{/other_user}","gists_url":"https://api.github.com/users/vritant/gists{/gist_id}","starred_url":"https://api.github.com/users/vritant/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vritant/subscriptions","organizations_url":"https://api.github.com/users/vritant/orgs","repos_url":"https://api.github.com/users/vritant/repos","events_url":"https://api.github.com/users/vritant/events{/privacy}","received_events_url":"https://api.github.com/users/vritant/received_events","type":"User","site_admin":false},"body":"@derek63  key is that result.setErrorMessage ensures the status is set to  MetadataResponse.Status.Error\r\n\r\ndefault value for status for every instance is MetadataResponse.Status.Success\r\nthis logic checks ( using foundActiveHost ) if any POST request of all the configured rest end points was successful. if none of them were, we need to set the status to error.\r\nthe check result.getStatus()==MetadataResponse.Status.Success is necessary to ensure we do not overwrite the error message set during exception handling.","created_at":"2015-03-18T17:15:59Z","updated_at":"2015-03-18T17:15:59Z","html_url":"https://github.com/esbtools/esb-message-admin/pull/25#discussion_r26684916","pull_request_url":"https://api.github.com/repos/esbtools/esb-message-admin/pulls/25","_links":{"self":{"href":"https://api.github.com/repos/esbtools/esb-message-admin/pulls/comments/26684916"},"html":{"href":"https://github.com/esbtools/esb-message-admin/pull/25#discussion_r26684916"},"pull_request":{"href":"https://api.github.com/repos/esbtools/esb-message-admin/pulls/25"}}},"pull_request":{"url":"https://api.github.com/repos/esbtools/esb-message-admin/pulls/25","id":31376130,"html_url":"https://github.com/esbtools/esb-message-admin/pull/25","diff_url":"https://github.com/esbtools/esb-message-admin/pull/25.diff","patch_url":"https://github.com/esbtools/esb-message-admin/pull/25.patch","issue_url":"https://api.github.com/repos/esbtools/esb-message-admin/issues/25","number":25,"state":"open","locked":false,"title":"Feature create sync message","user":{"login":"vritant","id":2501280,"avatar_url":"https://avatars.githubusercontent.com/u/2501280?v=3","gravatar_id":"","url":"https://api.github.com/users/vritant","html_url":"https://github.com/vritant","followers_url":"https://api.github.com/users/vritant/followers","following_url":"https://api.github.com/users/vritant/following{/other_user}","gists_url":"https://api.github.com/users/vritant/gists{/gist_id}","starred_url":"https://api.github.com/users/vritant/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vritant/subscriptions","organizations_url":"https://api.github.com/users/vritant/orgs","repos_url":"https://api.github.com/users/vritant/repos","events_url":"https://api.github.com/users/vritant/events{/privacy}","received_events_url":"https://api.github.com/users/vritant/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-03-17T20:46:01Z","updated_at":"2015-03-18T17:15:59Z","closed_at":null,"merged_at":null,"merge_commit_sha":"c5185ad5dff20c22fa8f1b5f69e427da53f7ead9","assignee":{"login":"derek63","id":990017,"avatar_url":"https://avatars.githubusercontent.com/u/990017?v=3","gravatar_id":"","url":"https://api.github.com/users/derek63","html_url":"https://github.com/derek63","followers_url":"https://api.github.com/users/derek63/followers","following_url":"https://api.github.com/users/derek63/following{/other_user}","gists_url":"https://api.github.com/users/derek63/gists{/gist_id}","starred_url":"https://api.github.com/users/derek63/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/derek63/subscriptions","organizations_url":"https://api.github.com/users/derek63/orgs","repos_url":"https://api.github.com/users/derek63/repos","events_url":"https://api.github.com/users/derek63/events{/privacy}","received_events_url":"https://api.github.com/users/derek63/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/esbtools/esb-message-admin/pulls/25/commits","review_comments_url":"https://api.github.com/repos/esbtools/esb-message-admin/pulls/25/comments","review_comment_url":"https://api.github.com/repos/esbtools/esb-message-admin/pulls/comments{/number}","comments_url":"https://api.github.com/repos/esbtools/esb-message-admin/issues/25/comments","statuses_url":"https://api.github.com/repos/esbtools/esb-message-admin/statuses/9577d7186495da5de5841abaec18a9af74f4bd66","head":{"label":"vritant:feature-create-sync-message","ref":"feature-create-sync-message","sha":"9577d7186495da5de5841abaec18a9af74f4bd66","user":{"login":"vritant","id":2501280,"avatar_url":"https://avatars.githubusercontent.com/u/2501280?v=3","gravatar_id":"","url":"https://api.github.com/users/vritant","html_url":"https://github.com/vritant","followers_url":"https://api.github.com/users/vritant/followers","following_url":"https://api.github.com/users/vritant/following{/other_user}","gists_url":"https://api.github.com/users/vritant/gists{/gist_id}","starred_url":"https://api.github.com/users/vritant/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vritant/subscriptions","organizations_url":"https://api.github.com/users/vritant/orgs","repos_url":"https://api.github.com/users/vritant/repos","events_url":"https://api.github.com/users/vritant/events{/privacy}","received_events_url":"https://api.github.com/users/vritant/received_events","type":"User","site_admin":false},"repo":{"id":31193912,"name":"esb-message-admin","full_name":"vritant/esb-message-admin","owner":{"login":"vritant","id":2501280,"avatar_url":"https://avatars.githubusercontent.com/u/2501280?v=3","gravatar_id":"","url":"https://api.github.com/users/vritant","html_url":"https://github.com/vritant","followers_url":"https://api.github.com/users/vritant/followers","following_url":"https://api.github.com/users/vritant/following{/other_user}","gists_url":"https://api.github.com/users/vritant/gists{/gist_id}","starred_url":"https://api.github.com/users/vritant/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vritant/subscriptions","organizations_url":"https://api.github.com/users/vritant/orgs","repos_url":"https://api.github.com/users/vritant/repos","events_url":"https://api.github.com/users/vritant/events{/privacy}","received_events_url":"https://api.github.com/users/vritant/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/vritant/esb-message-admin","description":"","fork":true,"url":"https://api.github.com/repos/vritant/esb-message-admin","forks_url":"https://api.github.com/repos/vritant/esb-message-admin/forks","keys_url":"https://api.github.com/repos/vritant/esb-message-admin/keys{/key_id}","collaborators_url":"https://api.github.com/repos/vritant/esb-message-admin/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/vritant/esb-message-admin/teams","hooks_url":"https://api.github.com/repos/vritant/esb-message-admin/hooks","issue_events_url":"https://api.github.com/repos/vritant/esb-message-admin/issues/events{/number}","events_url":"https://api.github.com/repos/vritant/esb-message-admin/events","assignees_url":"https://api.github.com/repos/vritant/esb-message-admin/assignees{/user}","branches_url":"https://api.github.com/repos/vritant/esb-message-admin/branches{/branch}","tags_url":"https://api.github.com/repos/vritant/esb-message-admin/tags","blobs_url":"https://api.github.com/repos/vritant/esb-message-admin/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/vritant/esb-message-admin/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/vritant/esb-message-admin/git/refs{/sha}","trees_url":"https://api.github.com/repos/vritant/esb-message-admin/git/trees{/sha}","statuses_url":"https://api.github.com/repos/vritant/esb-message-admin/statuses/{sha}","languages_url":"https://api.github.com/repos/vritant/esb-message-admin/languages","stargazers_url":"https://api.github.com/repos/vritant/esb-message-admin/stargazers","contributors_url":"https://api.github.com/repos/vritant/esb-message-admin/contributors","subscribers_url":"https://api.github.com/repos/vritant/esb-message-admin/subscribers","subscription_url":"https://api.github.com/repos/vritant/esb-message-admin/subscription","commits_url":"https://api.github.com/repos/vritant/esb-message-admin/commits{/sha}","git_commits_url":"https://api.github.com/repos/vritant/esb-message-admin/git/commits{/sha}","comments_url":"https://api.github.com/repos/vritant/esb-message-admin/comments{/number}","issue_comment_url":"https://api.github.com/repos/vritant/esb-message-admin/issues/comments{/number}","contents_url":"https://api.github.com/repos/vritant/esb-message-admin/contents/{+path}","compare_url":"https://api.github.com/repos/vritant/esb-message-admin/compare/{base}...{head}","merges_url":"https://api.github.com/repos/vritant/esb-message-admin/merges","archive_url":"https://api.github.com/repos/vritant/esb-message-admin/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/vritant/esb-message-admin/downloads","issues_url":"https://api.github.com/repos/vritant/esb-message-admin/issues{/number}","pulls_url":"https://api.github.com/repos/vritant/esb-message-admin/pulls{/number}","milestones_url":"https://api.github.com/repos/vritant/esb-message-admin/milestones{/number}","notifications_url":"https://api.github.com/repos/vritant/esb-message-admin/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/vritant/esb-message-admin/labels{/name}","releases_url":"https://api.github.com/repos/vritant/esb-message-admin/releases{/id}","created_at":"2015-02-23T04:27:22Z","updated_at":"2015-03-13T18:11:41Z","pushed_at":"2015-03-18T15:46:19Z","git_url":"git://github.com/vritant/esb-message-admin.git","ssh_url":"git@github.com:vritant/esb-message-admin.git","clone_url":"https://github.com/vritant/esb-message-admin.git","svn_url":"https://github.com/vritant/esb-message-admin","homepage":null,"size":12556,"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":"esbtools:master","ref":"master","sha":"a91b5ff095baecd23aad5099606909370508d217","user":{"login":"esbtools","id":10727765,"avatar_url":"https://avatars.githubusercontent.com/u/10727765?v=3","gravatar_id":"","url":"https://api.github.com/users/esbtools","html_url":"https://github.com/esbtools","followers_url":"https://api.github.com/users/esbtools/followers","following_url":"https://api.github.com/users/esbtools/following{/other_user}","gists_url":"https://api.github.com/users/esbtools/gists{/gist_id}","starred_url":"https://api.github.com/users/esbtools/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/esbtools/subscriptions","organizations_url":"https://api.github.com/users/esbtools/orgs","repos_url":"https://api.github.com/users/esbtools/repos","events_url":"https://api.github.com/users/esbtools/events{/privacy}","received_events_url":"https://api.github.com/users/esbtools/received_events","type":"Organization","site_admin":false},"repo":{"id":29922133,"name":"esb-message-admin","full_name":"esbtools/esb-message-admin","owner":{"login":"esbtools","id":10727765,"avatar_url":"https://avatars.githubusercontent.com/u/10727765?v=3","gravatar_id":"","url":"https://api.github.com/users/esbtools","html_url":"https://github.com/esbtools","followers_url":"https://api.github.com/users/esbtools/followers","following_url":"https://api.github.com/users/esbtools/following{/other_user}","gists_url":"https://api.github.com/users/esbtools/gists{/gist_id}","starred_url":"https://api.github.com/users/esbtools/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/esbtools/subscriptions","organizations_url":"https://api.github.com/users/esbtools/orgs","repos_url":"https://api.github.com/users/esbtools/repos","events_url":"https://api.github.com/users/esbtools/events{/privacy}","received_events_url":"https://api.github.com/users/esbtools/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/esbtools/esb-message-admin","description":"","fork":false,"url":"https://api.github.com/repos/esbtools/esb-message-admin","forks_url":"https://api.github.com/repos/esbtools/esb-message-admin/forks","keys_url":"https://api.github.com/repos/esbtools/esb-message-admin/keys{/key_id}","collaborators_url":"https://api.github.com/repos/esbtools/esb-message-admin/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/esbtools/esb-message-admin/teams","hooks_url":"https://api.github.com/repos/esbtools/esb-message-admin/hooks","issue_events_url":"https://api.github.com/repos/esbtools/esb-message-admin/issues/events{/number}","events_url":"https://api.github.com/repos/esbtools/esb-message-admin/events","assignees_url":"https://api.github.com/repos/esbtools/esb-message-admin/assignees{/user}","branches_url":"https://api.github.com/repos/esbtools/esb-message-admin/branches{/branch}","tags_url":"https://api.github.com/repos/esbtools/esb-message-admin/tags","blobs_url":"https://api.github.com/repos/esbtools/esb-message-admin/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/esbtools/esb-message-admin/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/esbtools/esb-message-admin/git/refs{/sha}","trees_url":"https://api.github.com/repos/esbtools/esb-message-admin/git/trees{/sha}","statuses_url":"https://api.github.com/repos/esbtools/esb-message-admin/statuses/{sha}","languages_url":"https://api.github.com/repos/esbtools/esb-message-admin/languages","stargazers_url":"https://api.github.com/repos/esbtools/esb-message-admin/stargazers","contributors_url":"https://api.github.com/repos/esbtools/esb-message-admin/contributors","subscribers_url":"https://api.github.com/repos/esbtools/esb-message-admin/subscribers","subscription_url":"https://api.github.com/repos/esbtools/esb-message-admin/subscription","commits_url":"https://api.github.com/repos/esbtools/esb-message-admin/commits{/sha}","git_commits_url":"https://api.github.com/repos/esbtools/esb-message-admin/git/commits{/sha}","comments_url":"https://api.github.com/repos/esbtools/esb-message-admin/comments{/number}","issue_comment_url":"https://api.github.com/repos/esbtools/esb-message-admin/issues/comments{/number}","contents_url":"https://api.github.com/repos/esbtools/esb-message-admin/contents/{+path}","compare_url":"https://api.github.com/repos/esbtools/esb-message-admin/compare/{base}...{head}","merges_url":"https://api.github.com/repos/esbtools/esb-message-admin/merges","archive_url":"https://api.github.com/repos/esbtools/esb-message-admin/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/esbtools/esb-message-admin/downloads","issues_url":"https://api.github.com/repos/esbtools/esb-message-admin/issues{/number}","pulls_url":"https://api.github.com/repos/esbtools/esb-message-admin/pulls{/number}","milestones_url":"https://api.github.com/repos/esbtools/esb-message-admin/milestones{/number}","notifications_url":"https://api.github.com/repos/esbtools/esb-message-admin/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/esbtools/esb-message-admin/labels{/name}","releases_url":"https://api.github.com/repos/esbtools/esb-message-admin/releases{/id}","created_at":"2015-01-27T16:10:32Z","updated_at":"2015-03-13T18:06:10Z","pushed_at":"2015-03-13T18:06:10Z","git_url":"git://github.com/esbtools/esb-message-admin.git","ssh_url":"git@github.com:esbtools/esb-message-admin.git","clone_url":"https://github.com/esbtools/esb-message-admin.git","svn_url":"https://github.com/esbtools/esb-message-admin","homepage":null,"size":12729,"stargazers_count":3,"watchers_count":3,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3,"mirror_url":null,"open_issues_count":8,"forks":3,"open_issues":8,"watchers":3,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/esbtools/esb-message-admin/pulls/25"},"html":{"href":"https://github.com/esbtools/esb-message-admin/pull/25"},"issue":{"href":"https://api.github.com/repos/esbtools/esb-message-admin/issues/25"},"comments":{"href":"https://api.github.com/repos/esbtools/esb-message-admin/issues/25/comments"},"review_comments":{"href":"https://api.github.com/repos/esbtools/esb-message-admin/pulls/25/comments"},"review_comment":{"href":"https://api.github.com/repos/esbtools/esb-message-admin/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/esbtools/esb-message-admin/pulls/25/commits"},"statuses":{"href":"https://api.github.com/repos/esbtools/esb-message-admin/statuses/9577d7186495da5de5841abaec18a9af74f4bd66"}}}}