{"action":"created","comment":{"url":"https://api.github.com/repos/wso2/wso2-axis2-transports/pulls/comments/62350342","id":62350342,"diff_hunk":"@@ -354,53 +364,120 @@ public JMSMessageSender createJMSSender() throws JMSException {\n         \t//treat jmsdestination type=queue(default is queue)\n         \t destType = JMSConstants.QUEUE;\n              qConFac = (QueueConnectionFactory) connectionFactory;\n-        }        \n-        \n-        Connection connection = null;\n-        if (user != null && pass != null) {\n-            if (qConFac != null) {\n-                connection = qConFac.createQueueConnection(user, pass);\n-            } else if (tConFac != null) {\n-                connection = tConFac.createTopicConnection(user, pass);\n+        }\n+\n+        if(msgCtx.getProperty(JMSConstants.JMS_XA_TRANSACTION_MANAGER) != null) {\n+            XAConnection connection = null;\n+            if (user != null && pass != null) {\n+                if (qConFac != null) {\n+                    connection = ((XAConnectionFactory) qConFac).createXAConnection(user, pass);\n+                } else if (tConFac != null) {\n+                    connection = ((XAConnectionFactory) tConFac).createXAConnection(user, pass);\n+                }\n+            } else {\n+                if (qConFac != null) {\n+                    connection = ((XAConnectionFactory) qConFac).createXAConnection();\n+                } else if (tConFac != null)  {\n+                    connection = ((XAConnectionFactory) tConFac).createXAConnection();\n+                }\n             }\n-        } else {\n-           if (qConFac != null) {\n-                connection = qConFac.createQueueConnection();\n-            } else if (tConFac != null)  {\n-                connection = tConFac.createTopicConnection();\n+\n+            if (connection == null) {\n+                connection = ((XAConnectionFactory) qConFac).createXAConnection();\n             }\n-        }\n \n-        if (connection == null) {\n-            connection = jmsConnectionFactory != null ? jmsConnectionFactory.getConnection() : null;\n-        }\n+            XASession session = null;\n+            MessageProducer producer = null;\n \n-        Session session = null;\n-        MessageProducer producer = null;\n+            if (connection != null) {\n+                if (destType == JMSConstants.QUEUE) {\n+                    session = connection.createXASession();\n+                    producer = session.createProducer(destination);\n+                } else {\n+                    session = connection.createXASession();\n+                    producer = session.createProducer(destination);\n+                }\n+            }\n \n-        if (connection != null) {\n-            if (destType == JMSConstants.QUEUE) {\n-                session = ((QueueConnection) connection).\n-                        createQueueSession(false, Session.AUTO_ACKNOWLEDGE);\n-                producer = ((QueueSession) session).createSender((Queue) destination);\n+            XAResource xaResource = session.getXAResource();\n+            TransactionManager tx = null;\n+            Xid xid1 = null;\n+            Transaction transaction = null;\n+\n+            try {\n+                tx = (TransactionManager) msgCtx.getProperty(JMSConstants.JMS_XA_TRANSACTION_MANAGER);\n+                transaction = tx.getTransaction();\n+                msgCtx.setProperty(JMSConstants.JMS_XA_TRANSACTION_MANAGER, tx);\n+                msgCtx.setProperty(JMSConstants.JMS_XA_TRANSACTION, transaction);\n+                xid1 = new JMSXid(JMSConstants.JMS_XA_TRANSACTION_PREFIX.getBytes(StandardCharsets.UTF_8), 1,\n+                        UUIDGenerator.getInstance().generateStringUUID().getBytes());","path":"modules/jms/src/main/java/org/apache/axis2/transport/jms/JMSOutTransportInfo.java","position":117,"original_position":117,"commit_id":"873764146ef5ea318c71c72d3ccd523d7cab50ea","original_commit_id":"873764146ef5ea318c71c72d3ccd523d7cab50ea","user":{"login":"Buddhima","id":1543384,"avatar_url":"https://avatars.githubusercontent.com/u/1543384?v=3","gravatar_id":"","url":"https://api.github.com/users/Buddhima","html_url":"https://github.com/Buddhima","followers_url":"https://api.github.com/users/Buddhima/followers","following_url":"https://api.github.com/users/Buddhima/following{/other_user}","gists_url":"https://api.github.com/users/Buddhima/gists{/gist_id}","starred_url":"https://api.github.com/users/Buddhima/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Buddhima/subscriptions","organizations_url":"https://api.github.com/users/Buddhima/orgs","repos_url":"https://api.github.com/users/Buddhima/repos","events_url":"https://api.github.com/users/Buddhima/events{/privacy}","received_events_url":"https://api.github.com/users/Buddhima/received_events","type":"User","site_admin":false},"body":"Isn't it possible to re-use a UUIDGenerator, rather including UUIDGenerator related code?","created_at":"2016-05-06T16:01:04Z","updated_at":"2016-05-06T16:01:04Z","html_url":"https://github.com/wso2/wso2-axis2-transports/pull/73#discussion_r62350342","pull_request_url":"https://api.github.com/repos/wso2/wso2-axis2-transports/pulls/73","_links":{"self":{"href":"https://api.github.com/repos/wso2/wso2-axis2-transports/pulls/comments/62350342"},"html":{"href":"https://github.com/wso2/wso2-axis2-transports/pull/73#discussion_r62350342"},"pull_request":{"href":"https://api.github.com/repos/wso2/wso2-axis2-transports/pulls/73"}}},"pull_request":{"url":"https://api.github.com/repos/wso2/wso2-axis2-transports/pulls/73","id":68970012,"html_url":"https://github.com/wso2/wso2-axis2-transports/pull/73","diff_url":"https://github.com/wso2/wso2-axis2-transports/pull/73.diff","patch_url":"https://github.com/wso2/wso2-axis2-transports/pull/73.patch","issue_url":"https://api.github.com/repos/wso2/wso2-axis2-transports/issues/73","number":73,"state":"open","locked":false,"title":"Adding distributed transaction support","user":{"login":"VijithaEkanayake","id":5285626,"avatar_url":"https://avatars.githubusercontent.com/u/5285626?v=3","gravatar_id":"","url":"https://api.github.com/users/VijithaEkanayake","html_url":"https://github.com/VijithaEkanayake","followers_url":"https://api.github.com/users/VijithaEkanayake/followers","following_url":"https://api.github.com/users/VijithaEkanayake/following{/other_user}","gists_url":"https://api.github.com/users/VijithaEkanayake/gists{/gist_id}","starred_url":"https://api.github.com/users/VijithaEkanayake/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/VijithaEkanayake/subscriptions","organizations_url":"https://api.github.com/users/VijithaEkanayake/orgs","repos_url":"https://api.github.com/users/VijithaEkanayake/repos","events_url":"https://api.github.com/users/VijithaEkanayake/events{/privacy}","received_events_url":"https://api.github.com/users/VijithaEkanayake/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-05-05T06:15:45Z","updated_at":"2016-05-06T16:01:04Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f1c43bec32374f7c9eb302a47d68ad370dd4bbc6","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/wso2/wso2-axis2-transports/pulls/73/commits","review_comments_url":"https://api.github.com/repos/wso2/wso2-axis2-transports/pulls/73/comments","review_comment_url":"https://api.github.com/repos/wso2/wso2-axis2-transports/pulls/comments{/number}","comments_url":"https://api.github.com/repos/wso2/wso2-axis2-transports/issues/73/comments","statuses_url":"https://api.github.com/repos/wso2/wso2-axis2-transports/statuses/873764146ef5ea318c71c72d3ccd523d7cab50ea","head":{"label":"VijithaEkanayake:master","ref":"master","sha":"873764146ef5ea318c71c72d3ccd523d7cab50ea","user":{"login":"VijithaEkanayake","id":5285626,"avatar_url":"https://avatars.githubusercontent.com/u/5285626?v=3","gravatar_id":"","url":"https://api.github.com/users/VijithaEkanayake","html_url":"https://github.com/VijithaEkanayake","followers_url":"https://api.github.com/users/VijithaEkanayake/followers","following_url":"https://api.github.com/users/VijithaEkanayake/following{/other_user}","gists_url":"https://api.github.com/users/VijithaEkanayake/gists{/gist_id}","starred_url":"https://api.github.com/users/VijithaEkanayake/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/VijithaEkanayake/subscriptions","organizations_url":"https://api.github.com/users/VijithaEkanayake/orgs","repos_url":"https://api.github.com/users/VijithaEkanayake/repos","events_url":"https://api.github.com/users/VijithaEkanayake/events{/privacy}","received_events_url":"https://api.github.com/users/VijithaEkanayake/received_events","type":"User","site_admin":false},"repo":{"id":35992285,"name":"wso2-axis2-transports","full_name":"VijithaEkanayake/wso2-axis2-transports","owner":{"login":"VijithaEkanayake","id":5285626,"avatar_url":"https://avatars.githubusercontent.com/u/5285626?v=3","gravatar_id":"","url":"https://api.github.com/users/VijithaEkanayake","html_url":"https://github.com/VijithaEkanayake","followers_url":"https://api.github.com/users/VijithaEkanayake/followers","following_url":"https://api.github.com/users/VijithaEkanayake/following{/other_user}","gists_url":"https://api.github.com/users/VijithaEkanayake/gists{/gist_id}","starred_url":"https://api.github.com/users/VijithaEkanayake/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/VijithaEkanayake/subscriptions","organizations_url":"https://api.github.com/users/VijithaEkanayake/orgs","repos_url":"https://api.github.com/users/VijithaEkanayake/repos","events_url":"https://api.github.com/users/VijithaEkanayake/events{/privacy}","received_events_url":"https://api.github.com/users/VijithaEkanayake/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/VijithaEkanayake/wso2-axis2-transports","description":"","fork":true,"url":"https://api.github.com/repos/VijithaEkanayake/wso2-axis2-transports","forks_url":"https://api.github.com/repos/VijithaEkanayake/wso2-axis2-transports/forks","keys_url":"https://api.github.com/repos/VijithaEkanayake/wso2-axis2-transports/keys{/key_id}","collaborators_url":"https://api.github.com/repos/VijithaEkanayake/wso2-axis2-transports/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/VijithaEkanayake/wso2-axis2-transports/teams","hooks_url":"https://api.github.com/repos/VijithaEkanayake/wso2-axis2-transports/hooks","issue_events_url":"https://api.github.com/repos/VijithaEkanayake/wso2-axis2-transports/issues/events{/number}","events_url":"https://api.github.com/repos/VijithaEkanayake/wso2-axis2-transports/events","assignees_url":"https://api.github.com/repos/VijithaEkanayake/wso2-axis2-transports/assignees{/user}","branches_url":"https://api.github.com/repos/VijithaEkanayake/wso2-axis2-transports/branches{/branch}","tags_url":"https://api.github.com/repos/VijithaEkanayake/wso2-axis2-transports/tags","blobs_url":"https://api.github.com/repos/VijithaEkanayake/wso2-axis2-transports/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/VijithaEkanayake/wso2-axis2-transports/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/VijithaEkanayake/wso2-axis2-transports/git/refs{/sha}","trees_url":"https://api.github.com/repos/VijithaEkanayake/wso2-axis2-transports/git/trees{/sha}","statuses_url":"https://api.github.com/repos/VijithaEkanayake/wso2-axis2-transports/statuses/{sha}","languages_url":"https://api.github.com/repos/VijithaEkanayake/wso2-axis2-transports/languages","stargazers_url":"https://api.github.com/repos/VijithaEkanayake/wso2-axis2-transports/stargazers","contributors_url":"https://api.github.com/repos/VijithaEkanayake/wso2-axis2-transports/contributors","subscribers_url":"https://api.github.com/repos/VijithaEkanayake/wso2-axis2-transports/subscribers","subscription_url":"https://api.github.com/repos/VijithaEkanayake/wso2-axis2-transports/subscription","commits_url":"https://api.github.com/repos/VijithaEkanayake/wso2-axis2-transports/commits{/sha}","git_commits_url":"https://api.github.com/repos/VijithaEkanayake/wso2-axis2-transports/git/commits{/sha}","comments_url":"https://api.github.com/repos/VijithaEkanayake/wso2-axis2-transports/comments{/number}","issue_comment_url":"https://api.github.com/repos/VijithaEkanayake/wso2-axis2-transports/issues/comments{/number}","contents_url":"https://api.github.com/repos/VijithaEkanayake/wso2-axis2-transports/contents/{+path}","compare_url":"https://api.github.com/repos/VijithaEkanayake/wso2-axis2-transports/compare/{base}...{head}","merges_url":"https://api.github.com/repos/VijithaEkanayake/wso2-axis2-transports/merges","archive_url":"https://api.github.com/repos/VijithaEkanayake/wso2-axis2-transports/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/VijithaEkanayake/wso2-axis2-transports/downloads","issues_url":"https://api.github.com/repos/VijithaEkanayake/wso2-axis2-transports/issues{/number}","pulls_url":"https://api.github.com/repos/VijithaEkanayake/wso2-axis2-transports/pulls{/number}","milestones_url":"https://api.github.com/repos/VijithaEkanayake/wso2-axis2-transports/milestones{/number}","notifications_url":"https://api.github.com/repos/VijithaEkanayake/wso2-axis2-transports/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/VijithaEkanayake/wso2-axis2-transports/labels{/name}","releases_url":"https://api.github.com/repos/VijithaEkanayake/wso2-axis2-transports/releases{/id}","deployments_url":"https://api.github.com/repos/VijithaEkanayake/wso2-axis2-transports/deployments","created_at":"2015-05-21T05:10:55Z","updated_at":"2016-02-19T13:08:56Z","pushed_at":"2016-05-05T06:13:09Z","git_url":"git://github.com/VijithaEkanayake/wso2-axis2-transports.git","ssh_url":"git@github.com:VijithaEkanayake/wso2-axis2-transports.git","clone_url":"https://github.com/VijithaEkanayake/wso2-axis2-transports.git","svn_url":"https://github.com/VijithaEkanayake/wso2-axis2-transports","homepage":null,"size":891,"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":"6655a345e94a592c92a2e905c4a1524f8a2af3dc","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":25507523,"name":"wso2-axis2-transports","full_name":"wso2/wso2-axis2-transports","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/wso2-axis2-transports","description":"","fork":false,"url":"https://api.github.com/repos/wso2/wso2-axis2-transports","forks_url":"https://api.github.com/repos/wso2/wso2-axis2-transports/forks","keys_url":"https://api.github.com/repos/wso2/wso2-axis2-transports/keys{/key_id}","collaborators_url":"https://api.github.com/repos/wso2/wso2-axis2-transports/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/wso2/wso2-axis2-transports/teams","hooks_url":"https://api.github.com/repos/wso2/wso2-axis2-transports/hooks","issue_events_url":"https://api.github.com/repos/wso2/wso2-axis2-transports/issues/events{/number}","events_url":"https://api.github.com/repos/wso2/wso2-axis2-transports/events","assignees_url":"https://api.github.com/repos/wso2/wso2-axis2-transports/assignees{/user}","branches_url":"https://api.github.com/repos/wso2/wso2-axis2-transports/branches{/branch}","tags_url":"https://api.github.com/repos/wso2/wso2-axis2-transports/tags","blobs_url":"https://api.github.com/repos/wso2/wso2-axis2-transports/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/wso2/wso2-axis2-transports/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/wso2/wso2-axis2-transports/git/refs{/sha}","trees_url":"https://api.github.com/repos/wso2/wso2-axis2-transports/git/trees{/sha}","statuses_url":"https://api.github.com/repos/wso2/wso2-axis2-transports/statuses/{sha}","languages_url":"https://api.github.com/repos/wso2/wso2-axis2-transports/languages","stargazers_url":"https://api.github.com/repos/wso2/wso2-axis2-transports/stargazers","contributors_url":"https://api.github.com/repos/wso2/wso2-axis2-transports/contributors","subscribers_url":"https://api.github.com/repos/wso2/wso2-axis2-transports/subscribers","subscription_url":"https://api.github.com/repos/wso2/wso2-axis2-transports/subscription","commits_url":"https://api.github.com/repos/wso2/wso2-axis2-transports/commits{/sha}","git_commits_url":"https://api.github.com/repos/wso2/wso2-axis2-transports/git/commits{/sha}","comments_url":"https://api.github.com/repos/wso2/wso2-axis2-transports/comments{/number}","issue_comment_url":"https://api.github.com/repos/wso2/wso2-axis2-transports/issues/comments{/number}","contents_url":"https://api.github.com/repos/wso2/wso2-axis2-transports/contents/{+path}","compare_url":"https://api.github.com/repos/wso2/wso2-axis2-transports/compare/{base}...{head}","merges_url":"https://api.github.com/repos/wso2/wso2-axis2-transports/merges","archive_url":"https://api.github.com/repos/wso2/wso2-axis2-transports/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/wso2/wso2-axis2-transports/downloads","issues_url":"https://api.github.com/repos/wso2/wso2-axis2-transports/issues{/number}","pulls_url":"https://api.github.com/repos/wso2/wso2-axis2-transports/pulls{/number}","milestones_url":"https://api.github.com/repos/wso2/wso2-axis2-transports/milestones{/number}","notifications_url":"https://api.github.com/repos/wso2/wso2-axis2-transports/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/wso2/wso2-axis2-transports/labels{/name}","releases_url":"https://api.github.com/repos/wso2/wso2-axis2-transports/releases{/id}","deployments_url":"https://api.github.com/repos/wso2/wso2-axis2-transports/deployments","created_at":"2014-10-21T07:03:40Z","updated_at":"2016-03-24T09:34:08Z","pushed_at":"2016-05-05T06:15:45Z","git_url":"git://github.com/wso2/wso2-axis2-transports.git","ssh_url":"git@github.com:wso2/wso2-axis2-transports.git","clone_url":"https://github.com/wso2/wso2-axis2-transports.git","svn_url":"https://github.com/wso2/wso2-axis2-transports","homepage":null,"size":901,"stargazers_count":4,"watchers_count":4,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":45,"mirror_url":null,"open_issues_count":4,"forks":45,"open_issues":4,"watchers":4,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/wso2/wso2-axis2-transports/pulls/73"},"html":{"href":"https://github.com/wso2/wso2-axis2-transports/pull/73"},"issue":{"href":"https://api.github.com/repos/wso2/wso2-axis2-transports/issues/73"},"comments":{"href":"https://api.github.com/repos/wso2/wso2-axis2-transports/issues/73/comments"},"review_comments":{"href":"https://api.github.com/repos/wso2/wso2-axis2-transports/pulls/73/comments"},"review_comment":{"href":"https://api.github.com/repos/wso2/wso2-axis2-transports/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/wso2/wso2-axis2-transports/pulls/73/commits"},"statuses":{"href":"https://api.github.com/repos/wso2/wso2-axis2-transports/statuses/873764146ef5ea318c71c72d3ccd523d7cab50ea"}}}}