{"action":"created","comment":{"url":"https://api.github.com/repos/Remiworks/EventBusFramework/pulls/comments/156423061","pull_request_review_id":82892152,"id":156423061,"diff_hunk":"@@ -0,0 +1,118 @@\n+﻿using System;\n+using System.Collections.Generic;\n+using System.Linq;\n+using System.Threading.Tasks;\n+using Newtonsoft.Json;\n+using Remiworks.Core.Event.Matching;\n+using Remiworks.Core.Models;\n+\n+namespace Remiworks.Core.Event\n+{\n+    public class EventListener : IEventListener\n+    {\n+        private readonly object _lockObject = new object();\n+\n+        private readonly Dictionary<string, List<CallbackForTopic>> _queueCallbacks;\n+        private readonly IBusProvider _busProvider;\n+\n+        public EventListener(IBusProvider busProvider)\n+        {\n+            _queueCallbacks = new Dictionary<string, List<CallbackForTopic>>();\n+            _busProvider = busProvider;\n+        }\n+\n+        public async Task SetupQueueListenerAsync<TParam>(string queueName, EventReceived<TParam> callback)\n+        {\n+            await SetupQueueListenerAsync(\n+                queueName, \n+                (input, topic) => callback((TParam) input, topic), \n+                typeof(TParam));\n+        }\n+\n+        public async Task SetupQueueListenerAsync(string queueName, EventReceived callback, Type type)\n+        {\n+            await Task.Run(() =>\n+            {\n+                void ReceivedCallback(EventMessage eventMessage)\n+                {\n+                    var messageObject = JsonConvert.DeserializeObject(eventMessage.JsonMessage, type);\n+                    \n+                    callback(messageObject, eventMessage.RoutingKey);\n+                }\n+\n+                _busProvider.BasicConsume(queueName, ReceivedCallback);\n+            });\n+        }\n+\n+        public async Task SetupQueueListenerAsync<TParam>(\n+            string queueName,\n+            string topic,\n+            EventReceivedForTopic<TParam> callback)\n+        {\n+            await SetupQueueListenerAsync(","path":"Remiworks/Remiworks.Core/Event/EventListener.cs","position":52,"original_position":52,"commit_id":"3944ff0746797db5fb176cf5aae450ee25778797","original_commit_id":"3944ff0746797db5fb176cf5aae450ee25778797","user":{"login":"TiruYasha","id":9056003,"avatar_url":"https://avatars2.githubusercontent.com/u/9056003?v=4","gravatar_id":"","url":"https://api.github.com/users/TiruYasha","html_url":"https://github.com/TiruYasha","followers_url":"https://api.github.com/users/TiruYasha/followers","following_url":"https://api.github.com/users/TiruYasha/following{/other_user}","gists_url":"https://api.github.com/users/TiruYasha/gists{/gist_id}","starred_url":"https://api.github.com/users/TiruYasha/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TiruYasha/subscriptions","organizations_url":"https://api.github.com/users/TiruYasha/orgs","repos_url":"https://api.github.com/users/TiruYasha/repos","events_url":"https://api.github.com/users/TiruYasha/events{/privacy}","received_events_url":"https://api.github.com/users/TiruYasha/received_events","type":"User","site_admin":false},"body":"Hier ook de task returnen","created_at":"2017-12-12T16:38:28Z","updated_at":"2017-12-12T17:04:31Z","html_url":"https://github.com/Remiworks/EventBusFramework/pull/23#discussion_r156423061","pull_request_url":"https://api.github.com/repos/Remiworks/EventBusFramework/pulls/23","author_association":"COLLABORATOR","_links":{"self":{"href":"https://api.github.com/repos/Remiworks/EventBusFramework/pulls/comments/156423061"},"html":{"href":"https://github.com/Remiworks/EventBusFramework/pull/23#discussion_r156423061"},"pull_request":{"href":"https://api.github.com/repos/Remiworks/EventBusFramework/pulls/23"}}},"pull_request":{"url":"https://api.github.com/repos/Remiworks/EventBusFramework/pulls/23","id":157862337,"html_url":"https://github.com/Remiworks/EventBusFramework/pull/23","diff_url":"https://github.com/Remiworks/EventBusFramework/pull/23.diff","patch_url":"https://github.com/Remiworks/EventBusFramework/pull/23.patch","issue_url":"https://api.github.com/repos/Remiworks/EventBusFramework/issues/23","number":23,"state":"open","locked":false,"title":"Event listener","user":{"login":"mikederksen","id":11157225,"avatar_url":"https://avatars1.githubusercontent.com/u/11157225?v=4","gravatar_id":"","url":"https://api.github.com/users/mikederksen","html_url":"https://github.com/mikederksen","followers_url":"https://api.github.com/users/mikederksen/followers","following_url":"https://api.github.com/users/mikederksen/following{/other_user}","gists_url":"https://api.github.com/users/mikederksen/gists{/gist_id}","starred_url":"https://api.github.com/users/mikederksen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mikederksen/subscriptions","organizations_url":"https://api.github.com/users/mikederksen/orgs","repos_url":"https://api.github.com/users/mikederksen/repos","events_url":"https://api.github.com/users/mikederksen/events{/privacy}","received_events_url":"https://api.github.com/users/mikederksen/received_events","type":"User","site_admin":false},"body":"","created_at":"2017-12-12T15:43:13Z","updated_at":"2017-12-12T17:04:31Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b51f21838da0a9afd1ef539fa894b47fcdeeb04e","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/Remiworks/EventBusFramework/pulls/23/commits","review_comments_url":"https://api.github.com/repos/Remiworks/EventBusFramework/pulls/23/comments","review_comment_url":"https://api.github.com/repos/Remiworks/EventBusFramework/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Remiworks/EventBusFramework/issues/23/comments","statuses_url":"https://api.github.com/repos/Remiworks/EventBusFramework/statuses/3944ff0746797db5fb176cf5aae450ee25778797","head":{"label":"Remiworks:EventListener","ref":"EventListener","sha":"3944ff0746797db5fb176cf5aae450ee25778797","user":{"login":"Remiworks","id":34334807,"avatar_url":"https://avatars1.githubusercontent.com/u/34334807?v=4","gravatar_id":"","url":"https://api.github.com/users/Remiworks","html_url":"https://github.com/Remiworks","followers_url":"https://api.github.com/users/Remiworks/followers","following_url":"https://api.github.com/users/Remiworks/following{/other_user}","gists_url":"https://api.github.com/users/Remiworks/gists{/gist_id}","starred_url":"https://api.github.com/users/Remiworks/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Remiworks/subscriptions","organizations_url":"https://api.github.com/users/Remiworks/orgs","repos_url":"https://api.github.com/users/Remiworks/repos","events_url":"https://api.github.com/users/Remiworks/events{/privacy}","received_events_url":"https://api.github.com/users/Remiworks/received_events","type":"Organization","site_admin":false},"repo":{"id":111907171,"name":"EventBusFramework","full_name":"Remiworks/EventBusFramework","owner":{"login":"Remiworks","id":34334807,"avatar_url":"https://avatars1.githubusercontent.com/u/34334807?v=4","gravatar_id":"","url":"https://api.github.com/users/Remiworks","html_url":"https://github.com/Remiworks","followers_url":"https://api.github.com/users/Remiworks/followers","following_url":"https://api.github.com/users/Remiworks/following{/other_user}","gists_url":"https://api.github.com/users/Remiworks/gists{/gist_id}","starred_url":"https://api.github.com/users/Remiworks/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Remiworks/subscriptions","organizations_url":"https://api.github.com/users/Remiworks/orgs","repos_url":"https://api.github.com/users/Remiworks/repos","events_url":"https://api.github.com/users/Remiworks/events{/privacy}","received_events_url":"https://api.github.com/users/Remiworks/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Remiworks/EventBusFramework","description":"Wrapper for RabbitMQ. This includes an attribute library for handling incoming events and commands.","fork":false,"url":"https://api.github.com/repos/Remiworks/EventBusFramework","forks_url":"https://api.github.com/repos/Remiworks/EventBusFramework/forks","keys_url":"https://api.github.com/repos/Remiworks/EventBusFramework/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Remiworks/EventBusFramework/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Remiworks/EventBusFramework/teams","hooks_url":"https://api.github.com/repos/Remiworks/EventBusFramework/hooks","issue_events_url":"https://api.github.com/repos/Remiworks/EventBusFramework/issues/events{/number}","events_url":"https://api.github.com/repos/Remiworks/EventBusFramework/events","assignees_url":"https://api.github.com/repos/Remiworks/EventBusFramework/assignees{/user}","branches_url":"https://api.github.com/repos/Remiworks/EventBusFramework/branches{/branch}","tags_url":"https://api.github.com/repos/Remiworks/EventBusFramework/tags","blobs_url":"https://api.github.com/repos/Remiworks/EventBusFramework/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Remiworks/EventBusFramework/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Remiworks/EventBusFramework/git/refs{/sha}","trees_url":"https://api.github.com/repos/Remiworks/EventBusFramework/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Remiworks/EventBusFramework/statuses/{sha}","languages_url":"https://api.github.com/repos/Remiworks/EventBusFramework/languages","stargazers_url":"https://api.github.com/repos/Remiworks/EventBusFramework/stargazers","contributors_url":"https://api.github.com/repos/Remiworks/EventBusFramework/contributors","subscribers_url":"https://api.github.com/repos/Remiworks/EventBusFramework/subscribers","subscription_url":"https://api.github.com/repos/Remiworks/EventBusFramework/subscription","commits_url":"https://api.github.com/repos/Remiworks/EventBusFramework/commits{/sha}","git_commits_url":"https://api.github.com/repos/Remiworks/EventBusFramework/git/commits{/sha}","comments_url":"https://api.github.com/repos/Remiworks/EventBusFramework/comments{/number}","issue_comment_url":"https://api.github.com/repos/Remiworks/EventBusFramework/issues/comments{/number}","contents_url":"https://api.github.com/repos/Remiworks/EventBusFramework/contents/{+path}","compare_url":"https://api.github.com/repos/Remiworks/EventBusFramework/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Remiworks/EventBusFramework/merges","archive_url":"https://api.github.com/repos/Remiworks/EventBusFramework/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Remiworks/EventBusFramework/downloads","issues_url":"https://api.github.com/repos/Remiworks/EventBusFramework/issues{/number}","pulls_url":"https://api.github.com/repos/Remiworks/EventBusFramework/pulls{/number}","milestones_url":"https://api.github.com/repos/Remiworks/EventBusFramework/milestones{/number}","notifications_url":"https://api.github.com/repos/Remiworks/EventBusFramework/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Remiworks/EventBusFramework/labels{/name}","releases_url":"https://api.github.com/repos/Remiworks/EventBusFramework/releases{/id}","deployments_url":"https://api.github.com/repos/Remiworks/EventBusFramework/deployments","created_at":"2017-11-24T10:40:05Z","updated_at":"2017-12-07T08:29:25Z","pushed_at":"2017-12-12T15:43:14Z","git_url":"git://github.com/Remiworks/EventBusFramework.git","ssh_url":"git@github.com:Remiworks/EventBusFramework.git","clone_url":"https://github.com/Remiworks/EventBusFramework.git","svn_url":"https://github.com/Remiworks/EventBusFramework","homepage":null,"size":190,"stargazers_count":0,"watchers_count":0,"language":"C#","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":8,"license":null,"forks":0,"open_issues":8,"watchers":0,"default_branch":"master"}},"base":{"label":"Remiworks:master","ref":"master","sha":"6aa629752e2b5568025dd1ed9f477a2915fb25b6","user":{"login":"Remiworks","id":34334807,"avatar_url":"https://avatars1.githubusercontent.com/u/34334807?v=4","gravatar_id":"","url":"https://api.github.com/users/Remiworks","html_url":"https://github.com/Remiworks","followers_url":"https://api.github.com/users/Remiworks/followers","following_url":"https://api.github.com/users/Remiworks/following{/other_user}","gists_url":"https://api.github.com/users/Remiworks/gists{/gist_id}","starred_url":"https://api.github.com/users/Remiworks/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Remiworks/subscriptions","organizations_url":"https://api.github.com/users/Remiworks/orgs","repos_url":"https://api.github.com/users/Remiworks/repos","events_url":"https://api.github.com/users/Remiworks/events{/privacy}","received_events_url":"https://api.github.com/users/Remiworks/received_events","type":"Organization","site_admin":false},"repo":{"id":111907171,"name":"EventBusFramework","full_name":"Remiworks/EventBusFramework","owner":{"login":"Remiworks","id":34334807,"avatar_url":"https://avatars1.githubusercontent.com/u/34334807?v=4","gravatar_id":"","url":"https://api.github.com/users/Remiworks","html_url":"https://github.com/Remiworks","followers_url":"https://api.github.com/users/Remiworks/followers","following_url":"https://api.github.com/users/Remiworks/following{/other_user}","gists_url":"https://api.github.com/users/Remiworks/gists{/gist_id}","starred_url":"https://api.github.com/users/Remiworks/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Remiworks/subscriptions","organizations_url":"https://api.github.com/users/Remiworks/orgs","repos_url":"https://api.github.com/users/Remiworks/repos","events_url":"https://api.github.com/users/Remiworks/events{/privacy}","received_events_url":"https://api.github.com/users/Remiworks/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Remiworks/EventBusFramework","description":"Wrapper for RabbitMQ. This includes an attribute library for handling incoming events and commands.","fork":false,"url":"https://api.github.com/repos/Remiworks/EventBusFramework","forks_url":"https://api.github.com/repos/Remiworks/EventBusFramework/forks","keys_url":"https://api.github.com/repos/Remiworks/EventBusFramework/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Remiworks/EventBusFramework/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Remiworks/EventBusFramework/teams","hooks_url":"https://api.github.com/repos/Remiworks/EventBusFramework/hooks","issue_events_url":"https://api.github.com/repos/Remiworks/EventBusFramework/issues/events{/number}","events_url":"https://api.github.com/repos/Remiworks/EventBusFramework/events","assignees_url":"https://api.github.com/repos/Remiworks/EventBusFramework/assignees{/user}","branches_url":"https://api.github.com/repos/Remiworks/EventBusFramework/branches{/branch}","tags_url":"https://api.github.com/repos/Remiworks/EventBusFramework/tags","blobs_url":"https://api.github.com/repos/Remiworks/EventBusFramework/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Remiworks/EventBusFramework/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Remiworks/EventBusFramework/git/refs{/sha}","trees_url":"https://api.github.com/repos/Remiworks/EventBusFramework/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Remiworks/EventBusFramework/statuses/{sha}","languages_url":"https://api.github.com/repos/Remiworks/EventBusFramework/languages","stargazers_url":"https://api.github.com/repos/Remiworks/EventBusFramework/stargazers","contributors_url":"https://api.github.com/repos/Remiworks/EventBusFramework/contributors","subscribers_url":"https://api.github.com/repos/Remiworks/EventBusFramework/subscribers","subscription_url":"https://api.github.com/repos/Remiworks/EventBusFramework/subscription","commits_url":"https://api.github.com/repos/Remiworks/EventBusFramework/commits{/sha}","git_commits_url":"https://api.github.com/repos/Remiworks/EventBusFramework/git/commits{/sha}","comments_url":"https://api.github.com/repos/Remiworks/EventBusFramework/comments{/number}","issue_comment_url":"https://api.github.com/repos/Remiworks/EventBusFramework/issues/comments{/number}","contents_url":"https://api.github.com/repos/Remiworks/EventBusFramework/contents/{+path}","compare_url":"https://api.github.com/repos/Remiworks/EventBusFramework/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Remiworks/EventBusFramework/merges","archive_url":"https://api.github.com/repos/Remiworks/EventBusFramework/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Remiworks/EventBusFramework/downloads","issues_url":"https://api.github.com/repos/Remiworks/EventBusFramework/issues{/number}","pulls_url":"https://api.github.com/repos/Remiworks/EventBusFramework/pulls{/number}","milestones_url":"https://api.github.com/repos/Remiworks/EventBusFramework/milestones{/number}","notifications_url":"https://api.github.com/repos/Remiworks/EventBusFramework/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Remiworks/EventBusFramework/labels{/name}","releases_url":"https://api.github.com/repos/Remiworks/EventBusFramework/releases{/id}","deployments_url":"https://api.github.com/repos/Remiworks/EventBusFramework/deployments","created_at":"2017-11-24T10:40:05Z","updated_at":"2017-12-07T08:29:25Z","pushed_at":"2017-12-12T15:43:14Z","git_url":"git://github.com/Remiworks/EventBusFramework.git","ssh_url":"git@github.com:Remiworks/EventBusFramework.git","clone_url":"https://github.com/Remiworks/EventBusFramework.git","svn_url":"https://github.com/Remiworks/EventBusFramework","homepage":null,"size":190,"stargazers_count":0,"watchers_count":0,"language":"C#","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":8,"license":null,"forks":0,"open_issues":8,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Remiworks/EventBusFramework/pulls/23"},"html":{"href":"https://github.com/Remiworks/EventBusFramework/pull/23"},"issue":{"href":"https://api.github.com/repos/Remiworks/EventBusFramework/issues/23"},"comments":{"href":"https://api.github.com/repos/Remiworks/EventBusFramework/issues/23/comments"},"review_comments":{"href":"https://api.github.com/repos/Remiworks/EventBusFramework/pulls/23/comments"},"review_comment":{"href":"https://api.github.com/repos/Remiworks/EventBusFramework/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Remiworks/EventBusFramework/pulls/23/commits"},"statuses":{"href":"https://api.github.com/repos/Remiworks/EventBusFramework/statuses/3944ff0746797db5fb176cf5aae450ee25778797"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"TiruYasha"}}