{"action":"created","comment":{"url":"https://api.github.com/repos/HBPVIS/zeq/pulls/comments/22514700","id":22514700,"diff_hunk":"@@ -0,0 +1,65 @@\n+\n+/* Copyright (c) 2014-2015, Human Brain Project\n+ *                          Stefan.Eilemann@epfl.ch\n+ */\n+\n+#include \"service.h\"\n+#include <zeq/publisher.h>\n+#include <lunchbox/log.h>\n+#include <lunchbox/sleep.h>\n+#include <zmq.h>\n+\n+namespace zeq\n+{\n+namespace connection\n+{\n+bool Service::subscribe( const std::string& brokerAddress,\n+                         const Publisher& publisher )\n+{\n+    void* context = zmq_ctx_new();\n+    void* socket = zmq_socket( context, ZMQ_REQ );\n+    const std::string zmqAddress = std::string(\"tcp://\" ) + brokerAddress;\n+    if( zmq_connect( socket, zmqAddress.c_str( )) == -1 )\n+    {\n+        LBINFO << \"Can't reach connection broker at \" << brokerAddress\n+               << std::endl;\n+        zmq_close( socket );\n+        zmq_ctx_destroy( context );\n+        return false;\n+    }\n+\n+    const std::string& address = publisher.getAddress();\n+    zmq_msg_t request;\n+    zmq_msg_init_size( &request, address.size( ));\n+    memcpy( zmq_msg_data( &request ), address.c_str(), address.size( ));\n+\n+    if( zmq_msg_send( &request, socket, 0 ) == -1 )\n+    {\n+        LBINFO << \"Can't send connection request \" << address << \" to \"","path":"zeq/connection/service.cpp","position":38,"original_position":38,"commit_id":"24f6ce25f47124afc9656fa88c7035b23ca6ed8f","original_commit_id":"24f6ce25f47124afc9656fa88c7035b23ca6ed8f","user":{"login":"eile","id":354947,"avatar_url":"https://avatars.githubusercontent.com/u/354947?v=3","gravatar_id":"","url":"https://api.github.com/users/eile","html_url":"https://github.com/eile","followers_url":"https://api.github.com/users/eile/followers","following_url":"https://api.github.com/users/eile/following{/other_user}","gists_url":"https://api.github.com/users/eile/gists{/gist_id}","starred_url":"https://api.github.com/users/eile/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eile/subscriptions","organizations_url":"https://api.github.com/users/eile/orgs","repos_url":"https://api.github.com/users/eile/repos","events_url":"https://api.github.com/users/eile/events{/privacy}","received_events_url":"https://api.github.com/users/eile/received_events","type":"User","site_admin":false},"body":"done","created_at":"2015-01-06T09:21:19Z","updated_at":"2015-01-06T09:21:19Z","html_url":"https://github.com/HBPVIS/zeq/pull/34#discussion_r22514700","pull_request_url":"https://api.github.com/repos/HBPVIS/zeq/pulls/34","_links":{"self":{"href":"https://api.github.com/repos/HBPVIS/zeq/pulls/comments/22514700"},"html":{"href":"https://github.com/HBPVIS/zeq/pull/34#discussion_r22514700"},"pull_request":{"href":"https://api.github.com/repos/HBPVIS/zeq/pulls/34"}}},"pull_request":{"url":"https://api.github.com/repos/HBPVIS/zeq/pulls/34","id":26822787,"html_url":"https://github.com/HBPVIS/zeq/pull/34","diff_url":"https://github.com/HBPVIS/zeq/pull/34.diff","patch_url":"https://github.com/HBPVIS/zeq/pull/34.patch","issue_url":"https://api.github.com/repos/HBPVIS/zeq/issues/34","number":34,"state":"open","locked":false,"title":"connection::Broker and Service implementation","user":{"login":"eile","id":354947,"avatar_url":"https://avatars.githubusercontent.com/u/354947?v=3","gravatar_id":"","url":"https://api.github.com/users/eile","html_url":"https://github.com/eile","followers_url":"https://api.github.com/users/eile/followers","following_url":"https://api.github.com/users/eile/following{/other_user}","gists_url":"https://api.github.com/users/eile/gists{/gist_id}","starred_url":"https://api.github.com/users/eile/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eile/subscriptions","organizations_url":"https://api.github.com/users/eile/orgs","repos_url":"https://api.github.com/users/eile/repos","events_url":"https://api.github.com/users/eile/events{/privacy}","received_events_url":"https://api.github.com/users/eile/received_events","type":"User","site_admin":false},"body":"See #29 for background","created_at":"2015-01-05T13:17:36Z","updated_at":"2015-01-06T09:21:19Z","closed_at":null,"merged_at":null,"merge_commit_sha":"48e8774fbff42be6ebacb13bfafe548c325db5f6","assignee":{"login":"eile","id":354947,"avatar_url":"https://avatars.githubusercontent.com/u/354947?v=3","gravatar_id":"","url":"https://api.github.com/users/eile","html_url":"https://github.com/eile","followers_url":"https://api.github.com/users/eile/followers","following_url":"https://api.github.com/users/eile/following{/other_user}","gists_url":"https://api.github.com/users/eile/gists{/gist_id}","starred_url":"https://api.github.com/users/eile/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eile/subscriptions","organizations_url":"https://api.github.com/users/eile/orgs","repos_url":"https://api.github.com/users/eile/repos","events_url":"https://api.github.com/users/eile/events{/privacy}","received_events_url":"https://api.github.com/users/eile/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/HBPVIS/zeq/pulls/34/commits","review_comments_url":"https://api.github.com/repos/HBPVIS/zeq/pulls/34/comments","review_comment_url":"https://api.github.com/repos/HBPVIS/zeq/pulls/comments/{number}","comments_url":"https://api.github.com/repos/HBPVIS/zeq/issues/34/comments","statuses_url":"https://api.github.com/repos/HBPVIS/zeq/statuses/24f6ce25f47124afc9656fa88c7035b23ca6ed8f","head":{"label":"eile:master","ref":"master","sha":"24f6ce25f47124afc9656fa88c7035b23ca6ed8f","user":{"login":"eile","id":354947,"avatar_url":"https://avatars.githubusercontent.com/u/354947?v=3","gravatar_id":"","url":"https://api.github.com/users/eile","html_url":"https://github.com/eile","followers_url":"https://api.github.com/users/eile/followers","following_url":"https://api.github.com/users/eile/following{/other_user}","gists_url":"https://api.github.com/users/eile/gists{/gist_id}","starred_url":"https://api.github.com/users/eile/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eile/subscriptions","organizations_url":"https://api.github.com/users/eile/orgs","repos_url":"https://api.github.com/users/eile/repos","events_url":"https://api.github.com/users/eile/events{/privacy}","received_events_url":"https://api.github.com/users/eile/received_events","type":"User","site_admin":false},"repo":{"id":22757567,"name":"zeq","full_name":"eile/zeq","owner":{"login":"eile","id":354947,"avatar_url":"https://avatars.githubusercontent.com/u/354947?v=3","gravatar_id":"","url":"https://api.github.com/users/eile","html_url":"https://github.com/eile","followers_url":"https://api.github.com/users/eile/followers","following_url":"https://api.github.com/users/eile/following{/other_user}","gists_url":"https://api.github.com/users/eile/gists{/gist_id}","starred_url":"https://api.github.com/users/eile/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eile/subscriptions","organizations_url":"https://api.github.com/users/eile/orgs","repos_url":"https://api.github.com/users/eile/repos","events_url":"https://api.github.com/users/eile/events{/privacy}","received_events_url":"https://api.github.com/users/eile/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/eile/zeq","description":"","fork":true,"url":"https://api.github.com/repos/eile/zeq","forks_url":"https://api.github.com/repos/eile/zeq/forks","keys_url":"https://api.github.com/repos/eile/zeq/keys{/key_id}","collaborators_url":"https://api.github.com/repos/eile/zeq/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/eile/zeq/teams","hooks_url":"https://api.github.com/repos/eile/zeq/hooks","issue_events_url":"https://api.github.com/repos/eile/zeq/issues/events{/number}","events_url":"https://api.github.com/repos/eile/zeq/events","assignees_url":"https://api.github.com/repos/eile/zeq/assignees{/user}","branches_url":"https://api.github.com/repos/eile/zeq/branches{/branch}","tags_url":"https://api.github.com/repos/eile/zeq/tags","blobs_url":"https://api.github.com/repos/eile/zeq/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/eile/zeq/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/eile/zeq/git/refs{/sha}","trees_url":"https://api.github.com/repos/eile/zeq/git/trees{/sha}","statuses_url":"https://api.github.com/repos/eile/zeq/statuses/{sha}","languages_url":"https://api.github.com/repos/eile/zeq/languages","stargazers_url":"https://api.github.com/repos/eile/zeq/stargazers","contributors_url":"https://api.github.com/repos/eile/zeq/contributors","subscribers_url":"https://api.github.com/repos/eile/zeq/subscribers","subscription_url":"https://api.github.com/repos/eile/zeq/subscription","commits_url":"https://api.github.com/repos/eile/zeq/commits{/sha}","git_commits_url":"https://api.github.com/repos/eile/zeq/git/commits{/sha}","comments_url":"https://api.github.com/repos/eile/zeq/comments{/number}","issue_comment_url":"https://api.github.com/repos/eile/zeq/issues/comments/{number}","contents_url":"https://api.github.com/repos/eile/zeq/contents/{+path}","compare_url":"https://api.github.com/repos/eile/zeq/compare/{base}...{head}","merges_url":"https://api.github.com/repos/eile/zeq/merges","archive_url":"https://api.github.com/repos/eile/zeq/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/eile/zeq/downloads","issues_url":"https://api.github.com/repos/eile/zeq/issues{/number}","pulls_url":"https://api.github.com/repos/eile/zeq/pulls{/number}","milestones_url":"https://api.github.com/repos/eile/zeq/milestones{/number}","notifications_url":"https://api.github.com/repos/eile/zeq/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/eile/zeq/labels{/name}","releases_url":"https://api.github.com/repos/eile/zeq/releases{/id}","created_at":"2014-08-08T12:49:39Z","updated_at":"2015-01-05T15:04:17Z","pushed_at":"2015-01-05T15:04:17Z","git_url":"git://github.com/eile/zeq.git","ssh_url":"git@github.com:eile/zeq.git","clone_url":"https://github.com/eile/zeq.git","svn_url":"https://github.com/eile/zeq","homepage":null,"size":572,"stargazers_count":0,"watchers_count":0,"language":"C++","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":"HBPVIS:master","ref":"master","sha":"948a5e807d362b0a879386fada9cadec0c42d1df","user":{"login":"HBPVIS","id":7261238,"avatar_url":"https://avatars.githubusercontent.com/u/7261238?v=3","gravatar_id":"","url":"https://api.github.com/users/HBPVIS","html_url":"https://github.com/HBPVIS","followers_url":"https://api.github.com/users/HBPVIS/followers","following_url":"https://api.github.com/users/HBPVIS/following{/other_user}","gists_url":"https://api.github.com/users/HBPVIS/gists{/gist_id}","starred_url":"https://api.github.com/users/HBPVIS/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/HBPVIS/subscriptions","organizations_url":"https://api.github.com/users/HBPVIS/orgs","repos_url":"https://api.github.com/users/HBPVIS/repos","events_url":"https://api.github.com/users/HBPVIS/events{/privacy}","received_events_url":"https://api.github.com/users/HBPVIS/received_events","type":"Organization","site_admin":false},"repo":{"id":21898897,"name":"zeq","full_name":"HBPVIS/zeq","owner":{"login":"HBPVIS","id":7261238,"avatar_url":"https://avatars.githubusercontent.com/u/7261238?v=3","gravatar_id":"","url":"https://api.github.com/users/HBPVIS","html_url":"https://github.com/HBPVIS","followers_url":"https://api.github.com/users/HBPVIS/followers","following_url":"https://api.github.com/users/HBPVIS/following{/other_user}","gists_url":"https://api.github.com/users/HBPVIS/gists{/gist_id}","starred_url":"https://api.github.com/users/HBPVIS/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/HBPVIS/subscriptions","organizations_url":"https://api.github.com/users/HBPVIS/orgs","repos_url":"https://api.github.com/users/HBPVIS/repos","events_url":"https://api.github.com/users/HBPVIS/events{/privacy}","received_events_url":"https://api.github.com/users/HBPVIS/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/HBPVIS/zeq","description":"Cross-platform C++ library to publish and subscribe to events","fork":false,"url":"https://api.github.com/repos/HBPVIS/zeq","forks_url":"https://api.github.com/repos/HBPVIS/zeq/forks","keys_url":"https://api.github.com/repos/HBPVIS/zeq/keys{/key_id}","collaborators_url":"https://api.github.com/repos/HBPVIS/zeq/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/HBPVIS/zeq/teams","hooks_url":"https://api.github.com/repos/HBPVIS/zeq/hooks","issue_events_url":"https://api.github.com/repos/HBPVIS/zeq/issues/events{/number}","events_url":"https://api.github.com/repos/HBPVIS/zeq/events","assignees_url":"https://api.github.com/repos/HBPVIS/zeq/assignees{/user}","branches_url":"https://api.github.com/repos/HBPVIS/zeq/branches{/branch}","tags_url":"https://api.github.com/repos/HBPVIS/zeq/tags","blobs_url":"https://api.github.com/repos/HBPVIS/zeq/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/HBPVIS/zeq/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/HBPVIS/zeq/git/refs{/sha}","trees_url":"https://api.github.com/repos/HBPVIS/zeq/git/trees{/sha}","statuses_url":"https://api.github.com/repos/HBPVIS/zeq/statuses/{sha}","languages_url":"https://api.github.com/repos/HBPVIS/zeq/languages","stargazers_url":"https://api.github.com/repos/HBPVIS/zeq/stargazers","contributors_url":"https://api.github.com/repos/HBPVIS/zeq/contributors","subscribers_url":"https://api.github.com/repos/HBPVIS/zeq/subscribers","subscription_url":"https://api.github.com/repos/HBPVIS/zeq/subscription","commits_url":"https://api.github.com/repos/HBPVIS/zeq/commits{/sha}","git_commits_url":"https://api.github.com/repos/HBPVIS/zeq/git/commits{/sha}","comments_url":"https://api.github.com/repos/HBPVIS/zeq/comments{/number}","issue_comment_url":"https://api.github.com/repos/HBPVIS/zeq/issues/comments/{number}","contents_url":"https://api.github.com/repos/HBPVIS/zeq/contents/{+path}","compare_url":"https://api.github.com/repos/HBPVIS/zeq/compare/{base}...{head}","merges_url":"https://api.github.com/repos/HBPVIS/zeq/merges","archive_url":"https://api.github.com/repos/HBPVIS/zeq/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/HBPVIS/zeq/downloads","issues_url":"https://api.github.com/repos/HBPVIS/zeq/issues{/number}","pulls_url":"https://api.github.com/repos/HBPVIS/zeq/pulls{/number}","milestones_url":"https://api.github.com/repos/HBPVIS/zeq/milestones{/number}","notifications_url":"https://api.github.com/repos/HBPVIS/zeq/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/HBPVIS/zeq/labels{/name}","releases_url":"https://api.github.com/repos/HBPVIS/zeq/releases{/id}","created_at":"2014-07-16T11:58:56Z","updated_at":"2014-12-16T15:52:24Z","pushed_at":"2014-12-16T15:52:24Z","git_url":"git://github.com/HBPVIS/zeq.git","ssh_url":"git@github.com:HBPVIS/zeq.git","clone_url":"https://github.com/HBPVIS/zeq.git","svn_url":"https://github.com/HBPVIS/zeq","homepage":"https://hbpvis.github.io/","size":705,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":9,"mirror_url":null,"open_issues_count":4,"forks":9,"open_issues":4,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/HBPVIS/zeq/pulls/34"},"html":{"href":"https://github.com/HBPVIS/zeq/pull/34"},"issue":{"href":"https://api.github.com/repos/HBPVIS/zeq/issues/34"},"comments":{"href":"https://api.github.com/repos/HBPVIS/zeq/issues/34/comments"},"review_comments":{"href":"https://api.github.com/repos/HBPVIS/zeq/pulls/34/comments"},"review_comment":{"href":"https://api.github.com/repos/HBPVIS/zeq/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/HBPVIS/zeq/pulls/34/commits"},"statuses":{"href":"https://api.github.com/repos/HBPVIS/zeq/statuses/24f6ce25f47124afc9656fa88c7035b23ca6ed8f"}}}}