{"action":"created","comment":{"url":"https://api.github.com/repos/carloscurotto/storm-example/pulls/comments/26766910","id":26766910,"diff_hunk":"@@ -0,0 +1,121 @@\n+package ar.com.carloscurotto.storm.complex.topology.propagator.gloss;\n+\n+import java.io.StringWriter;\n+import java.util.HashMap;\n+import java.util.Map;\n+\n+import javax.jms.JMSException;\n+import javax.xml.bind.JAXBContext;\n+import javax.xml.bind.JAXBException;\n+import javax.xml.bind.Marshaller;\n+import javax.xml.transform.stream.StreamResult;\n+\n+import org.apache.commons.lang3.Validate;\n+\n+import ar.com.carloscurotto.storm.complex.service.OpenAwareService;\n+import ar.com.carloscurotto.storm.complex.topology.propagator.gloss.destination.IDestination;\n+import ar.com.carloscurotto.storm.complex.topology.propagator.gloss.exception.GlossJmsException;\n+import ar.com.carloscurotto.storm.complex.topology.propagator.gloss.exception.GlossMarshalException;\n+import ar.com.carloscurotto.storm.complex.topology.propagator.gloss.message.ExcpTradeStatusMessage;\n+import ar.com.carloscurotto.storm.complex.topology.propagator.gloss.message.NormalTradeStatusMessage;\n+import ar.com.carloscurotto.storm.complex.topology.propagator.gloss.message.TradeCommentsMessage;\n+import ar.com.carloscurotto.storm.complex.topology.propagator.gloss.message.TradeMessage;\n+\n+\n+/**\n+ * Sends the message into the queue. Knows what queue to use and knows how to marshall the messages.\n+ *\n+ * @author D540601\n+ */\n+public class MessageSender extends OpenAwareService<Messages, Void> {\n+\n+    protected Map<Class<? extends TradeMessage>, Marshaller> marshallers = new HashMap<Class<? extends TradeMessage>, Marshaller>();\n+\n+    /**\n+     * Destination where the messages are directed.\n+     */\n+    protected IDestination destination;\n+    \n+    @Override\n+    protected void doOpen() {\n+        try {\n+            marshallers.put(NormalTradeStatusMessage.class,\n+                    JAXBContext.newInstance(NormalTradeStatusMessage.class).createMarshaller());\n+            marshallers.put(ExcpTradeStatusMessage.class,\n+                    JAXBContext.newInstance(ExcpTradeStatusMessage.class).createMarshaller());\n+            marshallers.put(TradeCommentsMessage.class,\n+                    JAXBContext.newInstance(TradeCommentsMessage.class).createMarshaller());\n+        } catch (JAXBException e) {\n+            throw new RuntimeException(\"MessageSender can't create the marshallers\", e);\n+        }\n+\n+    }\n+\n+    @Override\n+    protected void doClose() {\n+        try {\n+            destination.close();\n+        } catch (JMSException e) {\n+            throw new RuntimeException(\"MessageSender can't close destination\", e);\n+        }\n+    }\n+\n+    @Override\n+    protected Void doExecute(Messages theMessages) {","path":"src/main/java/ar/com/carloscurotto/storm/complex/topology/propagator/gloss/MessageSender.java","position":64,"original_position":64,"commit_id":"bf300bbc351f47af158a84c397756aec136a5b68","original_commit_id":"bf300bbc351f47af158a84c397756aec136a5b68","user":{"login":"carloscurotto","id":1410334,"avatar_url":"https://avatars.githubusercontent.com/u/1410334?v=3","gravatar_id":"","url":"https://api.github.com/users/carloscurotto","html_url":"https://github.com/carloscurotto","followers_url":"https://api.github.com/users/carloscurotto/followers","following_url":"https://api.github.com/users/carloscurotto/following{/other_user}","gists_url":"https://api.github.com/users/carloscurotto/gists{/gist_id}","starred_url":"https://api.github.com/users/carloscurotto/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/carloscurotto/subscriptions","organizations_url":"https://api.github.com/users/carloscurotto/orgs","repos_url":"https://api.github.com/users/carloscurotto/repos","events_url":"https://api.github.com/users/carloscurotto/events{/privacy}","received_events_url":"https://api.github.com/users/carloscurotto/received_events","type":"User","site_admin":false},"body":"Me gustaria que sea:\r\nprivate void doExecute(List theMessages) {\r\nfor(Message message : theMessages) send(message);\r\n}","created_at":"2015-03-19T15:49:25Z","updated_at":"2015-03-19T15:49:25Z","html_url":"https://github.com/carloscurotto/storm-example/pull/1#discussion_r26766910","pull_request_url":"https://api.github.com/repos/carloscurotto/storm-example/pulls/1","_links":{"self":{"href":"https://api.github.com/repos/carloscurotto/storm-example/pulls/comments/26766910"},"html":{"href":"https://github.com/carloscurotto/storm-example/pull/1#discussion_r26766910"},"pull_request":{"href":"https://api.github.com/repos/carloscurotto/storm-example/pulls/1"}}},"pull_request":{"url":"https://api.github.com/repos/carloscurotto/storm-example/pulls/1","id":31466648,"html_url":"https://github.com/carloscurotto/storm-example/pull/1","diff_url":"https://github.com/carloscurotto/storm-example/pull/1.diff","patch_url":"https://github.com/carloscurotto/storm-example/pull/1.patch","issue_url":"https://api.github.com/repos/carloscurotto/storm-example/issues/1","number":1,"state":"open","locked":false,"title":"Gloss submodule","user":{"login":"emacampolo","id":1101540,"avatar_url":"https://avatars.githubusercontent.com/u/1101540?v=3","gravatar_id":"","url":"https://api.github.com/users/emacampolo","html_url":"https://github.com/emacampolo","followers_url":"https://api.github.com/users/emacampolo/followers","following_url":"https://api.github.com/users/emacampolo/following{/other_user}","gists_url":"https://api.github.com/users/emacampolo/gists{/gist_id}","starred_url":"https://api.github.com/users/emacampolo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/emacampolo/subscriptions","organizations_url":"https://api.github.com/users/emacampolo/orgs","repos_url":"https://api.github.com/users/emacampolo/repos","events_url":"https://api.github.com/users/emacampolo/events{/privacy}","received_events_url":"https://api.github.com/users/emacampolo/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-03-18T20:06:04Z","updated_at":"2015-03-19T15:49:25Z","closed_at":null,"merged_at":null,"merge_commit_sha":"c85ac74c2de1566896a0b5a66726a8da5ab9650c","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/carloscurotto/storm-example/pulls/1/commits","review_comments_url":"https://api.github.com/repos/carloscurotto/storm-example/pulls/1/comments","review_comment_url":"https://api.github.com/repos/carloscurotto/storm-example/pulls/comments{/number}","comments_url":"https://api.github.com/repos/carloscurotto/storm-example/issues/1/comments","statuses_url":"https://api.github.com/repos/carloscurotto/storm-example/statuses/bf300bbc351f47af158a84c397756aec136a5b68","head":{"label":"carloscurotto:glossSubmodule","ref":"glossSubmodule","sha":"bf300bbc351f47af158a84c397756aec136a5b68","user":{"login":"carloscurotto","id":1410334,"avatar_url":"https://avatars.githubusercontent.com/u/1410334?v=3","gravatar_id":"","url":"https://api.github.com/users/carloscurotto","html_url":"https://github.com/carloscurotto","followers_url":"https://api.github.com/users/carloscurotto/followers","following_url":"https://api.github.com/users/carloscurotto/following{/other_user}","gists_url":"https://api.github.com/users/carloscurotto/gists{/gist_id}","starred_url":"https://api.github.com/users/carloscurotto/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/carloscurotto/subscriptions","organizations_url":"https://api.github.com/users/carloscurotto/orgs","repos_url":"https://api.github.com/users/carloscurotto/repos","events_url":"https://api.github.com/users/carloscurotto/events{/privacy}","received_events_url":"https://api.github.com/users/carloscurotto/received_events","type":"User","site_admin":false},"repo":{"id":10831185,"name":"storm-example","full_name":"carloscurotto/storm-example","owner":{"login":"carloscurotto","id":1410334,"avatar_url":"https://avatars.githubusercontent.com/u/1410334?v=3","gravatar_id":"","url":"https://api.github.com/users/carloscurotto","html_url":"https://github.com/carloscurotto","followers_url":"https://api.github.com/users/carloscurotto/followers","following_url":"https://api.github.com/users/carloscurotto/following{/other_user}","gists_url":"https://api.github.com/users/carloscurotto/gists{/gist_id}","starred_url":"https://api.github.com/users/carloscurotto/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/carloscurotto/subscriptions","organizations_url":"https://api.github.com/users/carloscurotto/orgs","repos_url":"https://api.github.com/users/carloscurotto/repos","events_url":"https://api.github.com/users/carloscurotto/events{/privacy}","received_events_url":"https://api.github.com/users/carloscurotto/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/carloscurotto/storm-example","description":"A simple example of use of the storm framework for online stream processing","fork":false,"url":"https://api.github.com/repos/carloscurotto/storm-example","forks_url":"https://api.github.com/repos/carloscurotto/storm-example/forks","keys_url":"https://api.github.com/repos/carloscurotto/storm-example/keys{/key_id}","collaborators_url":"https://api.github.com/repos/carloscurotto/storm-example/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/carloscurotto/storm-example/teams","hooks_url":"https://api.github.com/repos/carloscurotto/storm-example/hooks","issue_events_url":"https://api.github.com/repos/carloscurotto/storm-example/issues/events{/number}","events_url":"https://api.github.com/repos/carloscurotto/storm-example/events","assignees_url":"https://api.github.com/repos/carloscurotto/storm-example/assignees{/user}","branches_url":"https://api.github.com/repos/carloscurotto/storm-example/branches{/branch}","tags_url":"https://api.github.com/repos/carloscurotto/storm-example/tags","blobs_url":"https://api.github.com/repos/carloscurotto/storm-example/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/carloscurotto/storm-example/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/carloscurotto/storm-example/git/refs{/sha}","trees_url":"https://api.github.com/repos/carloscurotto/storm-example/git/trees{/sha}","statuses_url":"https://api.github.com/repos/carloscurotto/storm-example/statuses/{sha}","languages_url":"https://api.github.com/repos/carloscurotto/storm-example/languages","stargazers_url":"https://api.github.com/repos/carloscurotto/storm-example/stargazers","contributors_url":"https://api.github.com/repos/carloscurotto/storm-example/contributors","subscribers_url":"https://api.github.com/repos/carloscurotto/storm-example/subscribers","subscription_url":"https://api.github.com/repos/carloscurotto/storm-example/subscription","commits_url":"https://api.github.com/repos/carloscurotto/storm-example/commits{/sha}","git_commits_url":"https://api.github.com/repos/carloscurotto/storm-example/git/commits{/sha}","comments_url":"https://api.github.com/repos/carloscurotto/storm-example/comments{/number}","issue_comment_url":"https://api.github.com/repos/carloscurotto/storm-example/issues/comments{/number}","contents_url":"https://api.github.com/repos/carloscurotto/storm-example/contents/{+path}","compare_url":"https://api.github.com/repos/carloscurotto/storm-example/compare/{base}...{head}","merges_url":"https://api.github.com/repos/carloscurotto/storm-example/merges","archive_url":"https://api.github.com/repos/carloscurotto/storm-example/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/carloscurotto/storm-example/downloads","issues_url":"https://api.github.com/repos/carloscurotto/storm-example/issues{/number}","pulls_url":"https://api.github.com/repos/carloscurotto/storm-example/pulls{/number}","milestones_url":"https://api.github.com/repos/carloscurotto/storm-example/milestones{/number}","notifications_url":"https://api.github.com/repos/carloscurotto/storm-example/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/carloscurotto/storm-example/labels{/name}","releases_url":"https://api.github.com/repos/carloscurotto/storm-example/releases{/id}","created_at":"2013-06-20T22:51:59Z","updated_at":"2015-03-18T18:10:34Z","pushed_at":"2015-03-19T14:46:40Z","git_url":"git://github.com/carloscurotto/storm-example.git","ssh_url":"git@github.com:carloscurotto/storm-example.git","clone_url":"https://github.com/carloscurotto/storm-example.git","svn_url":"https://github.com/carloscurotto/storm-example","homepage":null,"size":220,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":2,"forks":1,"open_issues":2,"watchers":0,"default_branch":"master"}},"base":{"label":"carloscurotto:master","ref":"master","sha":"164703fc8298069a1d6e4d1cce1b39785f9a73be","user":{"login":"carloscurotto","id":1410334,"avatar_url":"https://avatars.githubusercontent.com/u/1410334?v=3","gravatar_id":"","url":"https://api.github.com/users/carloscurotto","html_url":"https://github.com/carloscurotto","followers_url":"https://api.github.com/users/carloscurotto/followers","following_url":"https://api.github.com/users/carloscurotto/following{/other_user}","gists_url":"https://api.github.com/users/carloscurotto/gists{/gist_id}","starred_url":"https://api.github.com/users/carloscurotto/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/carloscurotto/subscriptions","organizations_url":"https://api.github.com/users/carloscurotto/orgs","repos_url":"https://api.github.com/users/carloscurotto/repos","events_url":"https://api.github.com/users/carloscurotto/events{/privacy}","received_events_url":"https://api.github.com/users/carloscurotto/received_events","type":"User","site_admin":false},"repo":{"id":10831185,"name":"storm-example","full_name":"carloscurotto/storm-example","owner":{"login":"carloscurotto","id":1410334,"avatar_url":"https://avatars.githubusercontent.com/u/1410334?v=3","gravatar_id":"","url":"https://api.github.com/users/carloscurotto","html_url":"https://github.com/carloscurotto","followers_url":"https://api.github.com/users/carloscurotto/followers","following_url":"https://api.github.com/users/carloscurotto/following{/other_user}","gists_url":"https://api.github.com/users/carloscurotto/gists{/gist_id}","starred_url":"https://api.github.com/users/carloscurotto/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/carloscurotto/subscriptions","organizations_url":"https://api.github.com/users/carloscurotto/orgs","repos_url":"https://api.github.com/users/carloscurotto/repos","events_url":"https://api.github.com/users/carloscurotto/events{/privacy}","received_events_url":"https://api.github.com/users/carloscurotto/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/carloscurotto/storm-example","description":"A simple example of use of the storm framework for online stream processing","fork":false,"url":"https://api.github.com/repos/carloscurotto/storm-example","forks_url":"https://api.github.com/repos/carloscurotto/storm-example/forks","keys_url":"https://api.github.com/repos/carloscurotto/storm-example/keys{/key_id}","collaborators_url":"https://api.github.com/repos/carloscurotto/storm-example/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/carloscurotto/storm-example/teams","hooks_url":"https://api.github.com/repos/carloscurotto/storm-example/hooks","issue_events_url":"https://api.github.com/repos/carloscurotto/storm-example/issues/events{/number}","events_url":"https://api.github.com/repos/carloscurotto/storm-example/events","assignees_url":"https://api.github.com/repos/carloscurotto/storm-example/assignees{/user}","branches_url":"https://api.github.com/repos/carloscurotto/storm-example/branches{/branch}","tags_url":"https://api.github.com/repos/carloscurotto/storm-example/tags","blobs_url":"https://api.github.com/repos/carloscurotto/storm-example/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/carloscurotto/storm-example/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/carloscurotto/storm-example/git/refs{/sha}","trees_url":"https://api.github.com/repos/carloscurotto/storm-example/git/trees{/sha}","statuses_url":"https://api.github.com/repos/carloscurotto/storm-example/statuses/{sha}","languages_url":"https://api.github.com/repos/carloscurotto/storm-example/languages","stargazers_url":"https://api.github.com/repos/carloscurotto/storm-example/stargazers","contributors_url":"https://api.github.com/repos/carloscurotto/storm-example/contributors","subscribers_url":"https://api.github.com/repos/carloscurotto/storm-example/subscribers","subscription_url":"https://api.github.com/repos/carloscurotto/storm-example/subscription","commits_url":"https://api.github.com/repos/carloscurotto/storm-example/commits{/sha}","git_commits_url":"https://api.github.com/repos/carloscurotto/storm-example/git/commits{/sha}","comments_url":"https://api.github.com/repos/carloscurotto/storm-example/comments{/number}","issue_comment_url":"https://api.github.com/repos/carloscurotto/storm-example/issues/comments{/number}","contents_url":"https://api.github.com/repos/carloscurotto/storm-example/contents/{+path}","compare_url":"https://api.github.com/repos/carloscurotto/storm-example/compare/{base}...{head}","merges_url":"https://api.github.com/repos/carloscurotto/storm-example/merges","archive_url":"https://api.github.com/repos/carloscurotto/storm-example/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/carloscurotto/storm-example/downloads","issues_url":"https://api.github.com/repos/carloscurotto/storm-example/issues{/number}","pulls_url":"https://api.github.com/repos/carloscurotto/storm-example/pulls{/number}","milestones_url":"https://api.github.com/repos/carloscurotto/storm-example/milestones{/number}","notifications_url":"https://api.github.com/repos/carloscurotto/storm-example/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/carloscurotto/storm-example/labels{/name}","releases_url":"https://api.github.com/repos/carloscurotto/storm-example/releases{/id}","created_at":"2013-06-20T22:51:59Z","updated_at":"2015-03-18T18:10:34Z","pushed_at":"2015-03-19T14:46:40Z","git_url":"git://github.com/carloscurotto/storm-example.git","ssh_url":"git@github.com:carloscurotto/storm-example.git","clone_url":"https://github.com/carloscurotto/storm-example.git","svn_url":"https://github.com/carloscurotto/storm-example","homepage":null,"size":220,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":2,"forks":1,"open_issues":2,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/carloscurotto/storm-example/pulls/1"},"html":{"href":"https://github.com/carloscurotto/storm-example/pull/1"},"issue":{"href":"https://api.github.com/repos/carloscurotto/storm-example/issues/1"},"comments":{"href":"https://api.github.com/repos/carloscurotto/storm-example/issues/1/comments"},"review_comments":{"href":"https://api.github.com/repos/carloscurotto/storm-example/pulls/1/comments"},"review_comment":{"href":"https://api.github.com/repos/carloscurotto/storm-example/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/carloscurotto/storm-example/pulls/1/commits"},"statuses":{"href":"https://api.github.com/repos/carloscurotto/storm-example/statuses/bf300bbc351f47af158a84c397756aec136a5b68"}}}}