{"action":"created","comment":{"url":"https://api.github.com/repos/wso2/andes/pulls/comments/74540426","id":74540426,"diff_hunk":"@@ -18,30 +18,75 @@\n \n package org.wso2.andes.kernel;\n \n+import org.apache.log4j.Logger;\n+import org.wso2.andes.server.ClusterResourceHolder;\n+import org.wso2.andes.server.cluster.coordination.ClusterEventNotifier;\n+import org.wso2.andes.server.cluster.coordination.ClusterNotification;\n+\n /**\n- * Listener listening for queue changes local and cluster\n+ * QueueListener listens and handles queue changes that have occurred locally and cluster-wide.\n  */\n-public interface QueueListener {\n+public class QueueListener {\n+\n+    Logger log = Logger.getLogger(QueueListener.class);\n \n-    public static enum QueueEvent {\n+    public enum QueueEvent {\n         ADDED,\n         DELETED,\n         PURGED\n     }\n \n     /**\n-     * Handle queue has changed in the cluster\n+     * Local event handler is used to notify local queue changes to the cluster.\n+     */\n+    private ClusterEventNotifier clusterEventNotifier;\n+\n+    public QueueListener(ClusterEventNotifier handler) {\n+        clusterEventNotifier = handler;\n+    }\n+\n+    /**\n+     * Handle when a queue has changed in the cluster.\n      *\n      * @param andesQueue changed queue\n      * @param changeType what type of change has happened\n      */\n-    public void handleClusterQueuesChanged(AndesQueue andesQueue, QueueEvent changeType) throws AndesException;\n+    public void handleClusterQueuesChanged(AndesQueue andesQueue, QueueEvent changeType) throws AndesException {\n+        if (log.isDebugEnabled()) {\n+            log.debug(\"Cluster event received: \" + andesQueue.encodeAsString());\n+        }\n+        switch (changeType) {\n+            case ADDED:\n+                //create a queue\n+                ClusterResourceHolder.getInstance().getVirtualHostConfigSynchronizer().clusterQueueAdded(andesQueue);\n+                break;\n+            case DELETED:\n+                //Delete remaining subscriptions from the local and cluster subscription maps\n+                ClusterResourceHolder.getInstance().getSubscriptionManager().deleteAllLocalSubscriptionsOfBoundQueue(\n+                        andesQueue.queueName, andesQueue.getProtocolType(), andesQueue.getDestinationType());","path":"modules/andes-core/broker/src/main/java/org/wso2/andes/kernel/QueueListener.java","position":69,"original_position":54,"commit_id":"d6531887191f5eec649a14b246dd50fb556c4a12","original_commit_id":"3607ac20611ff8d5140cf70e55175c437f3f245b","user":{"login":"a5anka","id":1148405,"avatar_url":"https://avatars.githubusercontent.com/u/1148405?v=3","gravatar_id":"","url":"https://api.github.com/users/a5anka","html_url":"https://github.com/a5anka","followers_url":"https://api.github.com/users/a5anka/followers","following_url":"https://api.github.com/users/a5anka/following{/other_user}","gists_url":"https://api.github.com/users/a5anka/gists{/gist_id}","starred_url":"https://api.github.com/users/a5anka/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/a5anka/subscriptions","organizations_url":"https://api.github.com/users/a5anka/orgs","repos_url":"https://api.github.com/users/a5anka/repos","events_url":"https://api.github.com/users/a5anka/events{/privacy}","received_events_url":"https://api.github.com/users/a5anka/received_events","type":"User","site_admin":false},"body":"Then if we are starting the subscription manager before event listener task, we can initialize the field with subscription manager. isn't it?","created_at":"2016-08-12T04:31:31Z","updated_at":"2016-08-12T04:31:31Z","html_url":"https://github.com/wso2/andes/pull/671#discussion_r74540426","pull_request_url":"https://api.github.com/repos/wso2/andes/pulls/671","_links":{"self":{"href":"https://api.github.com/repos/wso2/andes/pulls/comments/74540426"},"html":{"href":"https://github.com/wso2/andes/pull/671#discussion_r74540426"},"pull_request":{"href":"https://api.github.com/repos/wso2/andes/pulls/671"}}},"pull_request":{"url":"https://api.github.com/repos/wso2/andes/pulls/671","id":80391933,"html_url":"https://github.com/wso2/andes/pull/671","diff_url":"https://github.com/wso2/andes/pull/671.diff","patch_url":"https://github.com/wso2/andes/pull/671.patch","issue_url":"https://api.github.com/repos/wso2/andes/issues/671","number":671,"state":"open","locked":false,"title":"[MB-1704] Implemented RDBMS based cluster event synchronization","user":{"login":"sdkottegoda","id":1330107,"avatar_url":"https://avatars.githubusercontent.com/u/1330107?v=3","gravatar_id":"","url":"https://api.github.com/users/sdkottegoda","html_url":"https://github.com/sdkottegoda","followers_url":"https://api.github.com/users/sdkottegoda/followers","following_url":"https://api.github.com/users/sdkottegoda/following{/other_user}","gists_url":"https://api.github.com/users/sdkottegoda/gists{/gist_id}","starred_url":"https://api.github.com/users/sdkottegoda/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sdkottegoda/subscriptions","organizations_url":"https://api.github.com/users/sdkottegoda/orgs","repos_url":"https://api.github.com/users/sdkottegoda/repos","events_url":"https://api.github.com/users/sdkottegoda/events{/privacy}","received_events_url":"https://api.github.com/users/sdkottegoda/received_events","type":"User","site_admin":false},"body":"Addresses the issue reported at https://wso2.org/jira/browse/MB-1704\r\n\r\nNecessary configurations and database scripts are added with the PR https://github.com/wso2/carbon-business-messaging/pull/313","created_at":"2016-08-08T04:00:42Z","updated_at":"2016-08-12T04:31:31Z","closed_at":null,"merged_at":null,"merge_commit_sha":"456c6072969db6ac0e800c30d2f357285e256541","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/wso2/andes/pulls/671/commits","review_comments_url":"https://api.github.com/repos/wso2/andes/pulls/671/comments","review_comment_url":"https://api.github.com/repos/wso2/andes/pulls/comments{/number}","comments_url":"https://api.github.com/repos/wso2/andes/issues/671/comments","statuses_url":"https://api.github.com/repos/wso2/andes/statuses/d6531887191f5eec649a14b246dd50fb556c4a12","head":{"label":"sdkottegoda:RDBMS_based_cluster_notification_synchronization","ref":"RDBMS_based_cluster_notification_synchronization","sha":"d6531887191f5eec649a14b246dd50fb556c4a12","user":{"login":"sdkottegoda","id":1330107,"avatar_url":"https://avatars.githubusercontent.com/u/1330107?v=3","gravatar_id":"","url":"https://api.github.com/users/sdkottegoda","html_url":"https://github.com/sdkottegoda","followers_url":"https://api.github.com/users/sdkottegoda/followers","following_url":"https://api.github.com/users/sdkottegoda/following{/other_user}","gists_url":"https://api.github.com/users/sdkottegoda/gists{/gist_id}","starred_url":"https://api.github.com/users/sdkottegoda/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sdkottegoda/subscriptions","organizations_url":"https://api.github.com/users/sdkottegoda/orgs","repos_url":"https://api.github.com/users/sdkottegoda/repos","events_url":"https://api.github.com/users/sdkottegoda/events{/privacy}","received_events_url":"https://api.github.com/users/sdkottegoda/received_events","type":"User","site_admin":false},"repo":{"id":35259291,"name":"andes","full_name":"sdkottegoda/andes","owner":{"login":"sdkottegoda","id":1330107,"avatar_url":"https://avatars.githubusercontent.com/u/1330107?v=3","gravatar_id":"","url":"https://api.github.com/users/sdkottegoda","html_url":"https://github.com/sdkottegoda","followers_url":"https://api.github.com/users/sdkottegoda/followers","following_url":"https://api.github.com/users/sdkottegoda/following{/other_user}","gists_url":"https://api.github.com/users/sdkottegoda/gists{/gist_id}","starred_url":"https://api.github.com/users/sdkottegoda/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sdkottegoda/subscriptions","organizations_url":"https://api.github.com/users/sdkottegoda/orgs","repos_url":"https://api.github.com/users/sdkottegoda/repos","events_url":"https://api.github.com/users/sdkottegoda/events{/privacy}","received_events_url":"https://api.github.com/users/sdkottegoda/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/sdkottegoda/andes","description":"","fork":true,"url":"https://api.github.com/repos/sdkottegoda/andes","forks_url":"https://api.github.com/repos/sdkottegoda/andes/forks","keys_url":"https://api.github.com/repos/sdkottegoda/andes/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sdkottegoda/andes/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sdkottegoda/andes/teams","hooks_url":"https://api.github.com/repos/sdkottegoda/andes/hooks","issue_events_url":"https://api.github.com/repos/sdkottegoda/andes/issues/events{/number}","events_url":"https://api.github.com/repos/sdkottegoda/andes/events","assignees_url":"https://api.github.com/repos/sdkottegoda/andes/assignees{/user}","branches_url":"https://api.github.com/repos/sdkottegoda/andes/branches{/branch}","tags_url":"https://api.github.com/repos/sdkottegoda/andes/tags","blobs_url":"https://api.github.com/repos/sdkottegoda/andes/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sdkottegoda/andes/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sdkottegoda/andes/git/refs{/sha}","trees_url":"https://api.github.com/repos/sdkottegoda/andes/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sdkottegoda/andes/statuses/{sha}","languages_url":"https://api.github.com/repos/sdkottegoda/andes/languages","stargazers_url":"https://api.github.com/repos/sdkottegoda/andes/stargazers","contributors_url":"https://api.github.com/repos/sdkottegoda/andes/contributors","subscribers_url":"https://api.github.com/repos/sdkottegoda/andes/subscribers","subscription_url":"https://api.github.com/repos/sdkottegoda/andes/subscription","commits_url":"https://api.github.com/repos/sdkottegoda/andes/commits{/sha}","git_commits_url":"https://api.github.com/repos/sdkottegoda/andes/git/commits{/sha}","comments_url":"https://api.github.com/repos/sdkottegoda/andes/comments{/number}","issue_comment_url":"https://api.github.com/repos/sdkottegoda/andes/issues/comments{/number}","contents_url":"https://api.github.com/repos/sdkottegoda/andes/contents/{+path}","compare_url":"https://api.github.com/repos/sdkottegoda/andes/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sdkottegoda/andes/merges","archive_url":"https://api.github.com/repos/sdkottegoda/andes/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sdkottegoda/andes/downloads","issues_url":"https://api.github.com/repos/sdkottegoda/andes/issues{/number}","pulls_url":"https://api.github.com/repos/sdkottegoda/andes/pulls{/number}","milestones_url":"https://api.github.com/repos/sdkottegoda/andes/milestones{/number}","notifications_url":"https://api.github.com/repos/sdkottegoda/andes/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sdkottegoda/andes/labels{/name}","releases_url":"https://api.github.com/repos/sdkottegoda/andes/releases{/id}","deployments_url":"https://api.github.com/repos/sdkottegoda/andes/deployments","created_at":"2015-05-08T04:58:28Z","updated_at":"2016-06-03T03:05:39Z","pushed_at":"2016-08-11T09:28:27Z","git_url":"git://github.com/sdkottegoda/andes.git","ssh_url":"git@github.com:sdkottegoda/andes.git","clone_url":"https://github.com/sdkottegoda/andes.git","svn_url":"https://github.com/sdkottegoda/andes","homepage":null,"size":68394,"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":"wso2:master","ref":"master","sha":"d1dc52708fc26beab1907b6b6740296dd240913b","user":{"login":"wso2","id":533043,"avatar_url":"https://avatars.githubusercontent.com/u/533043?v=3","gravatar_id":"","url":"https://api.github.com/users/wso2","html_url":"https://github.com/wso2","followers_url":"https://api.github.com/users/wso2/followers","following_url":"https://api.github.com/users/wso2/following{/other_user}","gists_url":"https://api.github.com/users/wso2/gists{/gist_id}","starred_url":"https://api.github.com/users/wso2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wso2/subscriptions","organizations_url":"https://api.github.com/users/wso2/orgs","repos_url":"https://api.github.com/users/wso2/repos","events_url":"https://api.github.com/users/wso2/events{/privacy}","received_events_url":"https://api.github.com/users/wso2/received_events","type":"Organization","site_admin":false},"repo":{"id":20559270,"name":"andes","full_name":"wso2/andes","owner":{"login":"wso2","id":533043,"avatar_url":"https://avatars.githubusercontent.com/u/533043?v=3","gravatar_id":"","url":"https://api.github.com/users/wso2","html_url":"https://github.com/wso2","followers_url":"https://api.github.com/users/wso2/followers","following_url":"https://api.github.com/users/wso2/following{/other_user}","gists_url":"https://api.github.com/users/wso2/gists{/gist_id}","starred_url":"https://api.github.com/users/wso2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wso2/subscriptions","organizations_url":"https://api.github.com/users/wso2/orgs","repos_url":"https://api.github.com/users/wso2/repos","events_url":"https://api.github.com/users/wso2/events{/privacy}","received_events_url":"https://api.github.com/users/wso2/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/wso2/andes","description":"","fork":false,"url":"https://api.github.com/repos/wso2/andes","forks_url":"https://api.github.com/repos/wso2/andes/forks","keys_url":"https://api.github.com/repos/wso2/andes/keys{/key_id}","collaborators_url":"https://api.github.com/repos/wso2/andes/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/wso2/andes/teams","hooks_url":"https://api.github.com/repos/wso2/andes/hooks","issue_events_url":"https://api.github.com/repos/wso2/andes/issues/events{/number}","events_url":"https://api.github.com/repos/wso2/andes/events","assignees_url":"https://api.github.com/repos/wso2/andes/assignees{/user}","branches_url":"https://api.github.com/repos/wso2/andes/branches{/branch}","tags_url":"https://api.github.com/repos/wso2/andes/tags","blobs_url":"https://api.github.com/repos/wso2/andes/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/wso2/andes/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/wso2/andes/git/refs{/sha}","trees_url":"https://api.github.com/repos/wso2/andes/git/trees{/sha}","statuses_url":"https://api.github.com/repos/wso2/andes/statuses/{sha}","languages_url":"https://api.github.com/repos/wso2/andes/languages","stargazers_url":"https://api.github.com/repos/wso2/andes/stargazers","contributors_url":"https://api.github.com/repos/wso2/andes/contributors","subscribers_url":"https://api.github.com/repos/wso2/andes/subscribers","subscription_url":"https://api.github.com/repos/wso2/andes/subscription","commits_url":"https://api.github.com/repos/wso2/andes/commits{/sha}","git_commits_url":"https://api.github.com/repos/wso2/andes/git/commits{/sha}","comments_url":"https://api.github.com/repos/wso2/andes/comments{/number}","issue_comment_url":"https://api.github.com/repos/wso2/andes/issues/comments{/number}","contents_url":"https://api.github.com/repos/wso2/andes/contents/{+path}","compare_url":"https://api.github.com/repos/wso2/andes/compare/{base}...{head}","merges_url":"https://api.github.com/repos/wso2/andes/merges","archive_url":"https://api.github.com/repos/wso2/andes/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/wso2/andes/downloads","issues_url":"https://api.github.com/repos/wso2/andes/issues{/number}","pulls_url":"https://api.github.com/repos/wso2/andes/pulls{/number}","milestones_url":"https://api.github.com/repos/wso2/andes/milestones{/number}","notifications_url":"https://api.github.com/repos/wso2/andes/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/wso2/andes/labels{/name}","releases_url":"https://api.github.com/repos/wso2/andes/releases{/id}","deployments_url":"https://api.github.com/repos/wso2/andes/deployments","created_at":"2014-06-06T10:04:24Z","updated_at":"2016-01-11T04:42:59Z","pushed_at":"2016-08-12T03:38:32Z","git_url":"git://github.com/wso2/andes.git","ssh_url":"git@github.com:wso2/andes.git","clone_url":"https://github.com/wso2/andes.git","svn_url":"https://github.com/wso2/andes","homepage":null,"size":70907,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":46,"mirror_url":null,"open_issues_count":7,"forks":46,"open_issues":7,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/wso2/andes/pulls/671"},"html":{"href":"https://github.com/wso2/andes/pull/671"},"issue":{"href":"https://api.github.com/repos/wso2/andes/issues/671"},"comments":{"href":"https://api.github.com/repos/wso2/andes/issues/671/comments"},"review_comments":{"href":"https://api.github.com/repos/wso2/andes/pulls/671/comments"},"review_comment":{"href":"https://api.github.com/repos/wso2/andes/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/wso2/andes/pulls/671/commits"},"statuses":{"href":"https://api.github.com/repos/wso2/andes/statuses/d6531887191f5eec649a14b246dd50fb556c4a12"}}}}
{"actor":{"display_login":"a5anka"}}