{"action":"created","comment":{"url":"https://api.github.com/repos/confluentinc/confluent-kafka-dotnet/pulls/comments/172449741","pull_request_review_id":101463387,"id":172449741,"diff_hunk":"@@ -0,0 +1,121 @@\n+﻿// Copyright 2018 Confluent Inc.\n+//\n+// Licensed under the Apache License, Version 2.0 (the \"License\");\n+// you may not use this file except 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, software\n+// distributed under the License is distributed on an \"AS IS\" BASIS,\n+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+// See the License for the specific language governing permissions and\n+// limitations under the License.\n+//\n+// Refer to LICENSE for more information.\n+\n+using System;\n+using System.Collections.Generic;\n+using System.Threading;\n+using System.Threading.Tasks;\n+using Confluent.Kafka.Serialization;\n+using Avro;\n+using Avro.Generic;\n+\n+\n+namespace Confluent.Kafka.Examples.AvroSpecific\n+{\n+    class Program\n+    {\n+        static void Main(string[] args)\n+        {\n+            if (args.Length != 3)\n+            {\n+                Console.WriteLine(\"Usage: .. bootstrapServers schemaRegistryUrl topicName\");\n+                return;\n+            }\n+\n+            string bootstrapServers = args[0];\n+            string schemaRegistryUrl = args[1];\n+            string topicName = args[2];\n+\n+            var producerConfig = new Dictionary<string, object>\n+            {\n+                { \"bootstrap.servers\", bootstrapServers },\n+                // Note: you can specify more than one schema registry url using the\n+                // schema.registry.url property for redundancy (comma separated list).\n+                // The property name is not plural to follow the convention set by\n+                // the Java implementation.\n+                { \"schema.registry.url\", schemaRegistryUrl },\n+                // optional schema registry client properties:\n+                { \"schema.registry.connection.timeout.ms\", 5000 },\n+                { \"schema.registry.max.cached.schemas\", 10 },\n+                // optional avro serializer properties:\n+                { \"avro.serializer.buffer.bytes\", 50 },\n+                { \"avro.serializer.auto.register.schemas\", true }\n+            };\n+\n+            var consumerConfig = new Dictionary<string, object>\n+            {\n+                { \"bootstrap.servers\", bootstrapServers },\n+                { \"group.id\", Guid.NewGuid() },\n+                { \"schema.registry.url\", schemaRegistryUrl }\n+            };\n+\n+            var s = (RecordSchema)Schema.Parse(\n+                @\"{\n+                    \"\"namespace\"\": \"\"Confluent.Kafka.Examples.AvroSpecific\"\",\n+                    \"\"type\"\": \"\"record\"\",\n+                    \"\"name\"\": \"\"User\"\",\n+                    \"\"fields\"\": [\n+                        {\"\"name\"\": \"\"name\"\", \"\"type\"\": \"\"string\"\"},\n+                        {\"\"name\"\": \"\"favorite_number\"\",  \"\"type\"\": [\"\"int\"\", \"\"null\"\"]},\n+                        {\"\"name\"\": \"\"favorite_color\"\", \"\"type\"\": [\"\"string\"\", \"\"null\"\"]}\n+                    ]\n+                  }\"\n+            );\n+            \n+            using (var consumer = new Consumer<string, GenericRecord>(consumerConfig, new AvroDeserializer<string>(), new AvroDeserializer<GenericRecord>()))\n+            using (var producer = new Producer<string, GenericRecord>(producerConfig, new AvroSerializer<string>(), new AvroSerializer<GenericRecord>()))\n+            {\n+                consumer.OnMessage += (o, e)\n+                    => Console.WriteLine($\"Key: {e.Key}\\nValue: {e.Value}\");\n+\n+                consumer.OnError += (_, e)\n+                    => Console.WriteLine(\"Error: \" + e.Reason);\n+\n+                consumer.OnConsumeError += (_, e)\n+                    => Console.WriteLine(\"Consume error: \" + e.Error.Reason);\n+\n+                consumer.Subscribe(topicName);\n+\n+                CancellationTokenSource cts = new CancellationTokenSource();\n+                var consumeTask = Task.Factory.StartNew(() =>\n+                {\n+                    while (!cts.Token.IsCancellationRequested)","path":"examples/AvroGeneric/Program.cs","position":95,"original_position":95,"commit_id":"5b4a550d4fdb4590847d30779879f740823d9487","original_commit_id":"5b4a550d4fdb4590847d30779879f740823d9487","user":{"login":"edenhill","id":524990,"avatar_url":"https://avatars0.githubusercontent.com/u/524990?v=4","gravatar_id":"","url":"https://api.github.com/users/edenhill","html_url":"https://github.com/edenhill","followers_url":"https://api.github.com/users/edenhill/followers","following_url":"https://api.github.com/users/edenhill/following{/other_user}","gists_url":"https://api.github.com/users/edenhill/gists{/gist_id}","starred_url":"https://api.github.com/users/edenhill/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/edenhill/subscriptions","organizations_url":"https://api.github.com/users/edenhill/orgs","repos_url":"https://api.github.com/users/edenhill/repos","events_url":"https://api.github.com/users/edenhill/events{/privacy}","received_events_url":"https://api.github.com/users/edenhill/received_events","type":"User","site_admin":false},"body":"Rumour on the street is that this should be in a try-block due to AggregationExceptions ;)","created_at":"2018-03-06T09:08:04Z","updated_at":"2018-03-06T09:28:46Z","html_url":"https://github.com/confluentinc/confluent-kafka-dotnet/pull/447#discussion_r172449741","pull_request_url":"https://api.github.com/repos/confluentinc/confluent-kafka-dotnet/pulls/447","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/confluentinc/confluent-kafka-dotnet/pulls/comments/172449741"},"html":{"href":"https://github.com/confluentinc/confluent-kafka-dotnet/pull/447#discussion_r172449741"},"pull_request":{"href":"https://api.github.com/repos/confluentinc/confluent-kafka-dotnet/pulls/447"}}},"pull_request":{"url":"https://api.github.com/repos/confluentinc/confluent-kafka-dotnet/pulls/447","id":172625702,"html_url":"https://github.com/confluentinc/confluent-kafka-dotnet/pull/447","diff_url":"https://github.com/confluentinc/confluent-kafka-dotnet/pull/447.diff","patch_url":"https://github.com/confluentinc/confluent-kafka-dotnet/pull/447.patch","issue_url":"https://api.github.com/repos/confluentinc/confluent-kafka-dotnet/issues/447","number":447,"state":"open","locked":false,"title":"Serialize / Deserialize Avro.Generic.GenericRecord ","user":{"login":"mhowlett","id":19174,"avatar_url":"https://avatars2.githubusercontent.com/u/19174?v=4","gravatar_id":"","url":"https://api.github.com/users/mhowlett","html_url":"https://github.com/mhowlett","followers_url":"https://api.github.com/users/mhowlett/followers","following_url":"https://api.github.com/users/mhowlett/following{/other_user}","gists_url":"https://api.github.com/users/mhowlett/gists{/gist_id}","starred_url":"https://api.github.com/users/mhowlett/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mhowlett/subscriptions","organizations_url":"https://api.github.com/users/mhowlett/orgs","repos_url":"https://api.github.com/users/mhowlett/repos","events_url":"https://api.github.com/users/mhowlett/events{/privacy}","received_events_url":"https://api.github.com/users/mhowlett/received_events","type":"User","site_admin":false},"body":"@edenhill \r\n\r\nthe diff is a bit awkward, probably best to look at the code first.\r\n\r\nThe `GenericRecord` specialization of `AvroSerializer` / `AvroDeserializer` calls for a different implementation to the existing supported types, so I added an abstraction to support this. This refactoring will also come in handy in the future (there are still parts of the avro spec not supported).","created_at":"2018-03-02T23:01:03Z","updated_at":"2018-03-06T09:28:46Z","closed_at":null,"merged_at":null,"merge_commit_sha":"23e5d9002bcea3fc1c782d8edc4c81ebf07a0ef1","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/confluentinc/confluent-kafka-dotnet/pulls/447/commits","review_comments_url":"https://api.github.com/repos/confluentinc/confluent-kafka-dotnet/pulls/447/comments","review_comment_url":"https://api.github.com/repos/confluentinc/confluent-kafka-dotnet/pulls/comments{/number}","comments_url":"https://api.github.com/repos/confluentinc/confluent-kafka-dotnet/issues/447/comments","statuses_url":"https://api.github.com/repos/confluentinc/confluent-kafka-dotnet/statuses/5b4a550d4fdb4590847d30779879f740823d9487","head":{"label":"mhowlett:generic3","ref":"generic3","sha":"5b4a550d4fdb4590847d30779879f740823d9487","user":{"login":"mhowlett","id":19174,"avatar_url":"https://avatars2.githubusercontent.com/u/19174?v=4","gravatar_id":"","url":"https://api.github.com/users/mhowlett","html_url":"https://github.com/mhowlett","followers_url":"https://api.github.com/users/mhowlett/followers","following_url":"https://api.github.com/users/mhowlett/following{/other_user}","gists_url":"https://api.github.com/users/mhowlett/gists{/gist_id}","starred_url":"https://api.github.com/users/mhowlett/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mhowlett/subscriptions","organizations_url":"https://api.github.com/users/mhowlett/orgs","repos_url":"https://api.github.com/users/mhowlett/repos","events_url":"https://api.github.com/users/mhowlett/events{/privacy}","received_events_url":"https://api.github.com/users/mhowlett/received_events","type":"User","site_admin":false},"repo":{"id":80080758,"name":"confluent-kafka-dotnet","full_name":"mhowlett/confluent-kafka-dotnet","owner":{"login":"mhowlett","id":19174,"avatar_url":"https://avatars2.githubusercontent.com/u/19174?v=4","gravatar_id":"","url":"https://api.github.com/users/mhowlett","html_url":"https://github.com/mhowlett","followers_url":"https://api.github.com/users/mhowlett/followers","following_url":"https://api.github.com/users/mhowlett/following{/other_user}","gists_url":"https://api.github.com/users/mhowlett/gists{/gist_id}","starred_url":"https://api.github.com/users/mhowlett/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mhowlett/subscriptions","organizations_url":"https://api.github.com/users/mhowlett/orgs","repos_url":"https://api.github.com/users/mhowlett/repos","events_url":"https://api.github.com/users/mhowlett/events{/privacy}","received_events_url":"https://api.github.com/users/mhowlett/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/mhowlett/confluent-kafka-dotnet","description":".NET/C# Kafka Client","fork":true,"url":"https://api.github.com/repos/mhowlett/confluent-kafka-dotnet","forks_url":"https://api.github.com/repos/mhowlett/confluent-kafka-dotnet/forks","keys_url":"https://api.github.com/repos/mhowlett/confluent-kafka-dotnet/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mhowlett/confluent-kafka-dotnet/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mhowlett/confluent-kafka-dotnet/teams","hooks_url":"https://api.github.com/repos/mhowlett/confluent-kafka-dotnet/hooks","issue_events_url":"https://api.github.com/repos/mhowlett/confluent-kafka-dotnet/issues/events{/number}","events_url":"https://api.github.com/repos/mhowlett/confluent-kafka-dotnet/events","assignees_url":"https://api.github.com/repos/mhowlett/confluent-kafka-dotnet/assignees{/user}","branches_url":"https://api.github.com/repos/mhowlett/confluent-kafka-dotnet/branches{/branch}","tags_url":"https://api.github.com/repos/mhowlett/confluent-kafka-dotnet/tags","blobs_url":"https://api.github.com/repos/mhowlett/confluent-kafka-dotnet/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mhowlett/confluent-kafka-dotnet/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mhowlett/confluent-kafka-dotnet/git/refs{/sha}","trees_url":"https://api.github.com/repos/mhowlett/confluent-kafka-dotnet/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mhowlett/confluent-kafka-dotnet/statuses/{sha}","languages_url":"https://api.github.com/repos/mhowlett/confluent-kafka-dotnet/languages","stargazers_url":"https://api.github.com/repos/mhowlett/confluent-kafka-dotnet/stargazers","contributors_url":"https://api.github.com/repos/mhowlett/confluent-kafka-dotnet/contributors","subscribers_url":"https://api.github.com/repos/mhowlett/confluent-kafka-dotnet/subscribers","subscription_url":"https://api.github.com/repos/mhowlett/confluent-kafka-dotnet/subscription","commits_url":"https://api.github.com/repos/mhowlett/confluent-kafka-dotnet/commits{/sha}","git_commits_url":"https://api.github.com/repos/mhowlett/confluent-kafka-dotnet/git/commits{/sha}","comments_url":"https://api.github.com/repos/mhowlett/confluent-kafka-dotnet/comments{/number}","issue_comment_url":"https://api.github.com/repos/mhowlett/confluent-kafka-dotnet/issues/comments{/number}","contents_url":"https://api.github.com/repos/mhowlett/confluent-kafka-dotnet/contents/{+path}","compare_url":"https://api.github.com/repos/mhowlett/confluent-kafka-dotnet/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mhowlett/confluent-kafka-dotnet/merges","archive_url":"https://api.github.com/repos/mhowlett/confluent-kafka-dotnet/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mhowlett/confluent-kafka-dotnet/downloads","issues_url":"https://api.github.com/repos/mhowlett/confluent-kafka-dotnet/issues{/number}","pulls_url":"https://api.github.com/repos/mhowlett/confluent-kafka-dotnet/pulls{/number}","milestones_url":"https://api.github.com/repos/mhowlett/confluent-kafka-dotnet/milestones{/number}","notifications_url":"https://api.github.com/repos/mhowlett/confluent-kafka-dotnet/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mhowlett/confluent-kafka-dotnet/labels{/name}","releases_url":"https://api.github.com/repos/mhowlett/confluent-kafka-dotnet/releases{/id}","deployments_url":"https://api.github.com/repos/mhowlett/confluent-kafka-dotnet/deployments","created_at":"2017-01-26T02:53:34Z","updated_at":"2017-01-26T02:53:37Z","pushed_at":"2018-03-06T02:06:27Z","git_url":"git://github.com/mhowlett/confluent-kafka-dotnet.git","ssh_url":"git@github.com:mhowlett/confluent-kafka-dotnet.git","clone_url":"https://github.com/mhowlett/confluent-kafka-dotnet.git","svn_url":"https://github.com/mhowlett/confluent-kafka-dotnet","homepage":null,"size":1341,"stargazers_count":0,"watchers_count":0,"language":"C#","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":null,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"confluentinc:master","ref":"master","sha":"99f08d7da61b777b7001ec56dc52d154b3ef8d62","user":{"login":"confluentinc","id":9439498,"avatar_url":"https://avatars0.githubusercontent.com/u/9439498?v=4","gravatar_id":"","url":"https://api.github.com/users/confluentinc","html_url":"https://github.com/confluentinc","followers_url":"https://api.github.com/users/confluentinc/followers","following_url":"https://api.github.com/users/confluentinc/following{/other_user}","gists_url":"https://api.github.com/users/confluentinc/gists{/gist_id}","starred_url":"https://api.github.com/users/confluentinc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/confluentinc/subscriptions","organizations_url":"https://api.github.com/users/confluentinc/orgs","repos_url":"https://api.github.com/users/confluentinc/repos","events_url":"https://api.github.com/users/confluentinc/events{/privacy}","received_events_url":"https://api.github.com/users/confluentinc/received_events","type":"Organization","site_admin":false},"repo":{"id":72554578,"name":"confluent-kafka-dotnet","full_name":"confluentinc/confluent-kafka-dotnet","owner":{"login":"confluentinc","id":9439498,"avatar_url":"https://avatars0.githubusercontent.com/u/9439498?v=4","gravatar_id":"","url":"https://api.github.com/users/confluentinc","html_url":"https://github.com/confluentinc","followers_url":"https://api.github.com/users/confluentinc/followers","following_url":"https://api.github.com/users/confluentinc/following{/other_user}","gists_url":"https://api.github.com/users/confluentinc/gists{/gist_id}","starred_url":"https://api.github.com/users/confluentinc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/confluentinc/subscriptions","organizations_url":"https://api.github.com/users/confluentinc/orgs","repos_url":"https://api.github.com/users/confluentinc/repos","events_url":"https://api.github.com/users/confluentinc/events{/privacy}","received_events_url":"https://api.github.com/users/confluentinc/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/confluentinc/confluent-kafka-dotnet","description":"Confluent's Apache Kafka .NET client","fork":false,"url":"https://api.github.com/repos/confluentinc/confluent-kafka-dotnet","forks_url":"https://api.github.com/repos/confluentinc/confluent-kafka-dotnet/forks","keys_url":"https://api.github.com/repos/confluentinc/confluent-kafka-dotnet/keys{/key_id}","collaborators_url":"https://api.github.com/repos/confluentinc/confluent-kafka-dotnet/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/confluentinc/confluent-kafka-dotnet/teams","hooks_url":"https://api.github.com/repos/confluentinc/confluent-kafka-dotnet/hooks","issue_events_url":"https://api.github.com/repos/confluentinc/confluent-kafka-dotnet/issues/events{/number}","events_url":"https://api.github.com/repos/confluentinc/confluent-kafka-dotnet/events","assignees_url":"https://api.github.com/repos/confluentinc/confluent-kafka-dotnet/assignees{/user}","branches_url":"https://api.github.com/repos/confluentinc/confluent-kafka-dotnet/branches{/branch}","tags_url":"https://api.github.com/repos/confluentinc/confluent-kafka-dotnet/tags","blobs_url":"https://api.github.com/repos/confluentinc/confluent-kafka-dotnet/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/confluentinc/confluent-kafka-dotnet/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/confluentinc/confluent-kafka-dotnet/git/refs{/sha}","trees_url":"https://api.github.com/repos/confluentinc/confluent-kafka-dotnet/git/trees{/sha}","statuses_url":"https://api.github.com/repos/confluentinc/confluent-kafka-dotnet/statuses/{sha}","languages_url":"https://api.github.com/repos/confluentinc/confluent-kafka-dotnet/languages","stargazers_url":"https://api.github.com/repos/confluentinc/confluent-kafka-dotnet/stargazers","contributors_url":"https://api.github.com/repos/confluentinc/confluent-kafka-dotnet/contributors","subscribers_url":"https://api.github.com/repos/confluentinc/confluent-kafka-dotnet/subscribers","subscription_url":"https://api.github.com/repos/confluentinc/confluent-kafka-dotnet/subscription","commits_url":"https://api.github.com/repos/confluentinc/confluent-kafka-dotnet/commits{/sha}","git_commits_url":"https://api.github.com/repos/confluentinc/confluent-kafka-dotnet/git/commits{/sha}","comments_url":"https://api.github.com/repos/confluentinc/confluent-kafka-dotnet/comments{/number}","issue_comment_url":"https://api.github.com/repos/confluentinc/confluent-kafka-dotnet/issues/comments{/number}","contents_url":"https://api.github.com/repos/confluentinc/confluent-kafka-dotnet/contents/{+path}","compare_url":"https://api.github.com/repos/confluentinc/confluent-kafka-dotnet/compare/{base}...{head}","merges_url":"https://api.github.com/repos/confluentinc/confluent-kafka-dotnet/merges","archive_url":"https://api.github.com/repos/confluentinc/confluent-kafka-dotnet/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/confluentinc/confluent-kafka-dotnet/downloads","issues_url":"https://api.github.com/repos/confluentinc/confluent-kafka-dotnet/issues{/number}","pulls_url":"https://api.github.com/repos/confluentinc/confluent-kafka-dotnet/pulls{/number}","milestones_url":"https://api.github.com/repos/confluentinc/confluent-kafka-dotnet/milestones{/number}","notifications_url":"https://api.github.com/repos/confluentinc/confluent-kafka-dotnet/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/confluentinc/confluent-kafka-dotnet/labels{/name}","releases_url":"https://api.github.com/repos/confluentinc/confluent-kafka-dotnet/releases{/id}","deployments_url":"https://api.github.com/repos/confluentinc/confluent-kafka-dotnet/deployments","created_at":"2016-11-01T16:25:52Z","updated_at":"2018-03-05T10:34:20Z","pushed_at":"2018-03-06T02:08:14Z","git_url":"git://github.com/confluentinc/confluent-kafka-dotnet.git","ssh_url":"git@github.com:confluentinc/confluent-kafka-dotnet.git","clone_url":"https://github.com/confluentinc/confluent-kafka-dotnet.git","svn_url":"https://github.com/confluentinc/confluent-kafka-dotnet","homepage":"https://docs.confluent.io/current/clients/confluent-kafka-dotnet/api/Confluent.Kafka.html","size":810,"stargazers_count":414,"watchers_count":414,"language":"C#","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":138,"mirror_url":null,"archived":false,"open_issues_count":122,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0"},"forks":138,"open_issues":122,"watchers":414,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/confluentinc/confluent-kafka-dotnet/pulls/447"},"html":{"href":"https://github.com/confluentinc/confluent-kafka-dotnet/pull/447"},"issue":{"href":"https://api.github.com/repos/confluentinc/confluent-kafka-dotnet/issues/447"},"comments":{"href":"https://api.github.com/repos/confluentinc/confluent-kafka-dotnet/issues/447/comments"},"review_comments":{"href":"https://api.github.com/repos/confluentinc/confluent-kafka-dotnet/pulls/447/comments"},"review_comment":{"href":"https://api.github.com/repos/confluentinc/confluent-kafka-dotnet/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/confluentinc/confluent-kafka-dotnet/pulls/447/commits"},"statuses":{"href":"https://api.github.com/repos/confluentinc/confluent-kafka-dotnet/statuses/5b4a550d4fdb4590847d30779879f740823d9487"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"edenhill"}}