{"action":"created","comment":{"url":"https://api.github.com/repos/wso2/carbon-mediation/pulls/comments/43988786","id":43988786,"diff_hunk":"@@ -0,0 +1,368 @@\n+/**\n+ * Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.\n+ *\n+ * WSO2 Inc. licenses this file to you under the Apache License,\n+ * Version 2.0 (the \"License\"); you may not use this file except\n+ * in compliance with the License.\n+ * You may obtain a copy of the License at\n+ *\n+ * http://www.apache.org/licenses/LICENSE-2.0\n+ *\n+ * Unless required by applicable law or agreed to in writing,\n+ * software distributed under the License is distributed on an\n+ * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n+ * KIND, either express or implied.  See the License for the\n+ * specific language governing permissions and limitations\n+ * under the License.\n+ */\n+\n+package org.wso2.carbon.inbound.endpoint.protocol.rabbitmq;\n+\n+import com.rabbitmq.client.*;\n+import org.apache.commons.lang.StringUtils;\n+import org.apache.commons.logging.Log;\n+import org.apache.commons.logging.LogFactory;\n+\n+import java.io.IOException;\n+import java.util.Hashtable;\n+import java.util.Map;\n+import java.util.Properties;\n+\n+public class RabbitMQConnectionConsumer {\n+    private static final Log log = LogFactory.getLog(RabbitMQConnectionConsumer.class);\n+    private RabbitMQConnectionFactory rabbitMQConnectionFactory;\n+    private Properties rabbitMQProperties;\n+\n+    private static final int STATE_STOPPED = 0;\n+    private static final int STATE_STARTED = 1;\n+    private static final int STATE_PAUSED = 2;\n+    private static final int STATE_SHUTTING_DOWN = 3;\n+    private static final int STATE_FAILURE = 4;\n+    private static final int STATE_FAULTY = 5;\n+\n+    private volatile int workerState = STATE_STOPPED;\n+    private String factoryName;\n+    private Connection connection = null;\n+    private Channel channel = null;\n+    private boolean autoAck = false;\n+    private QueueingConsumer queueingConsumer;\n+    private String queueName, routeKey, exchangeName;\n+    private Hashtable<String, String> rabbitMQProps = new Hashtable<>();\n+    private RabbitMQInjectHandler injectHandler;\n+    private String consumerTagString;\n+\n+    private volatile boolean connected = false;\n+    private volatile boolean idle = false;\n+\n+    public RabbitMQConnectionConsumer(RabbitMQConnectionFactory rabbitMQConnectionFactory, Properties rabbitMQProperties, RabbitMQInjectHandler injectHandler) {\n+        this.rabbitMQConnectionFactory = rabbitMQConnectionFactory;\n+        this.rabbitMQProperties = rabbitMQProperties;\n+        this.injectHandler = injectHandler;\n+        this.rabbitMQProperties.putAll(rabbitMQProps);\n+    }\n+\n+    public void execute() {\n+","path":"components/inbound-endpoints/org.wso2.carbon.inbound.endpoint/src/main/java/org/wso2/carbon/inbound/endpoint/protocol/rabbitmq/RabbitMQConnectionConsumer.java","position":65,"original_position":65,"commit_id":"1032918c651b9b0e5f81173125b710e8738af295","original_commit_id":"1032918c651b9b0e5f81173125b710e8738af295","user":{"login":"kesavany","id":1311321,"avatar_url":"https://avatars.githubusercontent.com/u/1311321?v=3","gravatar_id":"","url":"https://api.github.com/users/kesavany","html_url":"https://github.com/kesavany","followers_url":"https://api.github.com/users/kesavany/followers","following_url":"https://api.github.com/users/kesavany/following{/other_user}","gists_url":"https://api.github.com/users/kesavany/gists{/gist_id}","starred_url":"https://api.github.com/users/kesavany/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kesavany/subscriptions","organizations_url":"https://api.github.com/users/kesavany/orgs","repos_url":"https://api.github.com/users/kesavany/repos","events_url":"https://api.github.com/users/kesavany/events{/privacy}","received_events_url":"https://api.github.com/users/kesavany/received_events","type":"User","site_admin":false},"body":"Fixed in https://github.com/wso2/carbon-mediation/pull/374","created_at":"2015-11-05T08:55:39Z","updated_at":"2015-11-05T08:55:39Z","html_url":"https://github.com/wso2/carbon-mediation/pull/374#discussion_r43988786","pull_request_url":"https://api.github.com/repos/wso2/carbon-mediation/pulls/374","_links":{"self":{"href":"https://api.github.com/repos/wso2/carbon-mediation/pulls/comments/43988786"},"html":{"href":"https://github.com/wso2/carbon-mediation/pull/374#discussion_r43988786"},"pull_request":{"href":"https://api.github.com/repos/wso2/carbon-mediation/pulls/374"}}},"pull_request":{"url":"https://api.github.com/repos/wso2/carbon-mediation/pulls/374","id":42319141,"html_url":"https://github.com/wso2/carbon-mediation/pull/374","diff_url":"https://github.com/wso2/carbon-mediation/pull/374.diff","patch_url":"https://github.com/wso2/carbon-mediation/pull/374.patch","issue_url":"https://api.github.com/repos/wso2/carbon-mediation/issues/374","number":374,"state":"closed","locked":false,"title":"RabbitMQ Inbound Endpoint","user":{"login":"kesavany","id":1311321,"avatar_url":"https://avatars.githubusercontent.com/u/1311321?v=3","gravatar_id":"","url":"https://api.github.com/users/kesavany","html_url":"https://github.com/kesavany","followers_url":"https://api.github.com/users/kesavany/followers","following_url":"https://api.github.com/users/kesavany/following{/other_user}","gists_url":"https://api.github.com/users/kesavany/gists{/gist_id}","starred_url":"https://api.github.com/users/kesavany/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kesavany/subscriptions","organizations_url":"https://api.github.com/users/kesavany/orgs","repos_url":"https://api.github.com/users/kesavany/repos","events_url":"https://api.github.com/users/kesavany/events{/privacy}","received_events_url":"https://api.github.com/users/kesavany/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-08-13T06:37:56Z","updated_at":"2015-11-05T08:55:39Z","closed_at":"2015-08-13T07:00:41Z","merged_at":"2015-08-13T07:00:41Z","merge_commit_sha":"067ddd0b5e6977f4f881d70f3646451f13be7224","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/wso2/carbon-mediation/pulls/374/commits","review_comments_url":"https://api.github.com/repos/wso2/carbon-mediation/pulls/374/comments","review_comment_url":"https://api.github.com/repos/wso2/carbon-mediation/pulls/comments{/number}","comments_url":"https://api.github.com/repos/wso2/carbon-mediation/issues/374/comments","statuses_url":"https://api.github.com/repos/wso2/carbon-mediation/statuses/1032918c651b9b0e5f81173125b710e8738af295","head":{"label":"kesavany:master","ref":"master","sha":"1032918c651b9b0e5f81173125b710e8738af295","user":{"login":"kesavany","id":1311321,"avatar_url":"https://avatars.githubusercontent.com/u/1311321?v=3","gravatar_id":"","url":"https://api.github.com/users/kesavany","html_url":"https://github.com/kesavany","followers_url":"https://api.github.com/users/kesavany/followers","following_url":"https://api.github.com/users/kesavany/following{/other_user}","gists_url":"https://api.github.com/users/kesavany/gists{/gist_id}","starred_url":"https://api.github.com/users/kesavany/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kesavany/subscriptions","organizations_url":"https://api.github.com/users/kesavany/orgs","repos_url":"https://api.github.com/users/kesavany/repos","events_url":"https://api.github.com/users/kesavany/events{/privacy}","received_events_url":"https://api.github.com/users/kesavany/received_events","type":"User","site_admin":false},"repo":{"id":40639361,"name":"carbon-mediation","full_name":"kesavany/carbon-mediation","owner":{"login":"kesavany","id":1311321,"avatar_url":"https://avatars.githubusercontent.com/u/1311321?v=3","gravatar_id":"","url":"https://api.github.com/users/kesavany","html_url":"https://github.com/kesavany","followers_url":"https://api.github.com/users/kesavany/followers","following_url":"https://api.github.com/users/kesavany/following{/other_user}","gists_url":"https://api.github.com/users/kesavany/gists{/gist_id}","starred_url":"https://api.github.com/users/kesavany/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kesavany/subscriptions","organizations_url":"https://api.github.com/users/kesavany/orgs","repos_url":"https://api.github.com/users/kesavany/repos","events_url":"https://api.github.com/users/kesavany/events{/privacy}","received_events_url":"https://api.github.com/users/kesavany/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/kesavany/carbon-mediation","description":"","fork":true,"url":"https://api.github.com/repos/kesavany/carbon-mediation","forks_url":"https://api.github.com/repos/kesavany/carbon-mediation/forks","keys_url":"https://api.github.com/repos/kesavany/carbon-mediation/keys{/key_id}","collaborators_url":"https://api.github.com/repos/kesavany/carbon-mediation/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/kesavany/carbon-mediation/teams","hooks_url":"https://api.github.com/repos/kesavany/carbon-mediation/hooks","issue_events_url":"https://api.github.com/repos/kesavany/carbon-mediation/issues/events{/number}","events_url":"https://api.github.com/repos/kesavany/carbon-mediation/events","assignees_url":"https://api.github.com/repos/kesavany/carbon-mediation/assignees{/user}","branches_url":"https://api.github.com/repos/kesavany/carbon-mediation/branches{/branch}","tags_url":"https://api.github.com/repos/kesavany/carbon-mediation/tags","blobs_url":"https://api.github.com/repos/kesavany/carbon-mediation/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/kesavany/carbon-mediation/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/kesavany/carbon-mediation/git/refs{/sha}","trees_url":"https://api.github.com/repos/kesavany/carbon-mediation/git/trees{/sha}","statuses_url":"https://api.github.com/repos/kesavany/carbon-mediation/statuses/{sha}","languages_url":"https://api.github.com/repos/kesavany/carbon-mediation/languages","stargazers_url":"https://api.github.com/repos/kesavany/carbon-mediation/stargazers","contributors_url":"https://api.github.com/repos/kesavany/carbon-mediation/contributors","subscribers_url":"https://api.github.com/repos/kesavany/carbon-mediation/subscribers","subscription_url":"https://api.github.com/repos/kesavany/carbon-mediation/subscription","commits_url":"https://api.github.com/repos/kesavany/carbon-mediation/commits{/sha}","git_commits_url":"https://api.github.com/repos/kesavany/carbon-mediation/git/commits{/sha}","comments_url":"https://api.github.com/repos/kesavany/carbon-mediation/comments{/number}","issue_comment_url":"https://api.github.com/repos/kesavany/carbon-mediation/issues/comments{/number}","contents_url":"https://api.github.com/repos/kesavany/carbon-mediation/contents/{+path}","compare_url":"https://api.github.com/repos/kesavany/carbon-mediation/compare/{base}...{head}","merges_url":"https://api.github.com/repos/kesavany/carbon-mediation/merges","archive_url":"https://api.github.com/repos/kesavany/carbon-mediation/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/kesavany/carbon-mediation/downloads","issues_url":"https://api.github.com/repos/kesavany/carbon-mediation/issues{/number}","pulls_url":"https://api.github.com/repos/kesavany/carbon-mediation/pulls{/number}","milestones_url":"https://api.github.com/repos/kesavany/carbon-mediation/milestones{/number}","notifications_url":"https://api.github.com/repos/kesavany/carbon-mediation/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/kesavany/carbon-mediation/labels{/name}","releases_url":"https://api.github.com/repos/kesavany/carbon-mediation/releases{/id}","created_at":"2015-08-13T04:46:01Z","updated_at":"2015-08-13T04:46:08Z","pushed_at":"2015-11-03T07:57:32Z","git_url":"git://github.com/kesavany/carbon-mediation.git","ssh_url":"git@github.com:kesavany/carbon-mediation.git","clone_url":"https://github.com/kesavany/carbon-mediation.git","svn_url":"https://github.com/kesavany/carbon-mediation","homepage":null,"size":15179,"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":"22bee13bca6b74eb8fe1adc8ace35d00b42bb2e8","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":16429916,"name":"carbon-mediation","full_name":"wso2/carbon-mediation","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/carbon-mediation","description":"","fork":false,"url":"https://api.github.com/repos/wso2/carbon-mediation","forks_url":"https://api.github.com/repos/wso2/carbon-mediation/forks","keys_url":"https://api.github.com/repos/wso2/carbon-mediation/keys{/key_id}","collaborators_url":"https://api.github.com/repos/wso2/carbon-mediation/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/wso2/carbon-mediation/teams","hooks_url":"https://api.github.com/repos/wso2/carbon-mediation/hooks","issue_events_url":"https://api.github.com/repos/wso2/carbon-mediation/issues/events{/number}","events_url":"https://api.github.com/repos/wso2/carbon-mediation/events","assignees_url":"https://api.github.com/repos/wso2/carbon-mediation/assignees{/user}","branches_url":"https://api.github.com/repos/wso2/carbon-mediation/branches{/branch}","tags_url":"https://api.github.com/repos/wso2/carbon-mediation/tags","blobs_url":"https://api.github.com/repos/wso2/carbon-mediation/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/wso2/carbon-mediation/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/wso2/carbon-mediation/git/refs{/sha}","trees_url":"https://api.github.com/repos/wso2/carbon-mediation/git/trees{/sha}","statuses_url":"https://api.github.com/repos/wso2/carbon-mediation/statuses/{sha}","languages_url":"https://api.github.com/repos/wso2/carbon-mediation/languages","stargazers_url":"https://api.github.com/repos/wso2/carbon-mediation/stargazers","contributors_url":"https://api.github.com/repos/wso2/carbon-mediation/contributors","subscribers_url":"https://api.github.com/repos/wso2/carbon-mediation/subscribers","subscription_url":"https://api.github.com/repos/wso2/carbon-mediation/subscription","commits_url":"https://api.github.com/repos/wso2/carbon-mediation/commits{/sha}","git_commits_url":"https://api.github.com/repos/wso2/carbon-mediation/git/commits{/sha}","comments_url":"https://api.github.com/repos/wso2/carbon-mediation/comments{/number}","issue_comment_url":"https://api.github.com/repos/wso2/carbon-mediation/issues/comments{/number}","contents_url":"https://api.github.com/repos/wso2/carbon-mediation/contents/{+path}","compare_url":"https://api.github.com/repos/wso2/carbon-mediation/compare/{base}...{head}","merges_url":"https://api.github.com/repos/wso2/carbon-mediation/merges","archive_url":"https://api.github.com/repos/wso2/carbon-mediation/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/wso2/carbon-mediation/downloads","issues_url":"https://api.github.com/repos/wso2/carbon-mediation/issues{/number}","pulls_url":"https://api.github.com/repos/wso2/carbon-mediation/pulls{/number}","milestones_url":"https://api.github.com/repos/wso2/carbon-mediation/milestones{/number}","notifications_url":"https://api.github.com/repos/wso2/carbon-mediation/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/wso2/carbon-mediation/labels{/name}","releases_url":"https://api.github.com/repos/wso2/carbon-mediation/releases{/id}","created_at":"2014-02-01T07:01:29Z","updated_at":"2015-08-04T05:49:11Z","pushed_at":"2015-11-05T08:54:14Z","git_url":"git://github.com/wso2/carbon-mediation.git","ssh_url":"git@github.com:wso2/carbon-mediation.git","clone_url":"https://github.com/wso2/carbon-mediation.git","svn_url":"https://github.com/wso2/carbon-mediation","homepage":null,"size":22139,"stargazers_count":2,"watchers_count":2,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":95,"mirror_url":null,"open_issues_count":38,"forks":95,"open_issues":38,"watchers":2,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/wso2/carbon-mediation/pulls/374"},"html":{"href":"https://github.com/wso2/carbon-mediation/pull/374"},"issue":{"href":"https://api.github.com/repos/wso2/carbon-mediation/issues/374"},"comments":{"href":"https://api.github.com/repos/wso2/carbon-mediation/issues/374/comments"},"review_comments":{"href":"https://api.github.com/repos/wso2/carbon-mediation/pulls/374/comments"},"review_comment":{"href":"https://api.github.com/repos/wso2/carbon-mediation/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/wso2/carbon-mediation/pulls/374/commits"},"statuses":{"href":"https://api.github.com/repos/wso2/carbon-mediation/statuses/1032918c651b9b0e5f81173125b710e8738af295"}}}}