{"action":"opened","issue":{"url":"https://api.github.com/repos/dotnetcore/CAP/issues/89","repository_url":"https://api.github.com/repos/dotnetcore/CAP","labels_url":"https://api.github.com/repos/dotnetcore/CAP/issues/89/labels{/name}","comments_url":"https://api.github.com/repos/dotnetcore/CAP/issues/89/comments","events_url":"https://api.github.com/repos/dotnetcore/CAP/issues/89/events","html_url":"https://github.com/dotnetcore/CAP/issues/89","id":300881254,"number":89,"title":"CapSubscribe Group Not Work ","user":{"login":"s995203","id":36907531,"avatar_url":"https://avatars1.githubusercontent.com/u/36907531?v=4","gravatar_id":"","url":"https://api.github.com/users/s995203","html_url":"https://github.com/s995203","followers_url":"https://api.github.com/users/s995203/followers","following_url":"https://api.github.com/users/s995203/following{/other_user}","gists_url":"https://api.github.com/users/s995203/gists{/gist_id}","starred_url":"https://api.github.com/users/s995203/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/s995203/subscriptions","organizations_url":"https://api.github.com/users/s995203/orgs","repos_url":"https://api.github.com/users/s995203/repos","events_url":"https://api.github.com/users/s995203/events{/privacy}","received_events_url":"https://api.github.com/users/s995203/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-02-28T03:45:55Z","updated_at":"2018-02-28T03:45:55Z","closed_at":null,"author_association":"NONE","body":"Group not working when use kafka\r\nIt's always DoSomthing1 or DoSomthing2\r\n\r\n        [CapSubscribe(\"users.added\", Group = \"user.doSomthing1\")]\r\n        public void DoSomthing1(User user)\r\n        {\r\n            // somthing here...\r\n        }\r\n\r\n        [CapSubscribe(\"users.added\", Group = \"user.doSomthing2\")]\r\n        public void DoSomthing2(User user)\r\n        {\r\n            // somthing here...\r\n        }\r\n\r\nI think it's because async task use same setting object, and not lock correctly\r\n\r\nDotNetCore.CAP.Kafka.KafkaConsumerClient\r\n\r\n        private void InitKafkaClient()\r\n        {\r\n            _kafkaOptions.MainConfig[\"group.id\"] = _groupId;\r\n\r\n            var config = _kafkaOptions.AsKafkaConfig();\r\n            _consumerClient = new Consumer<Null, string>(config, null, StringDeserializer);\r\n            _consumerClient.OnConsumeError += ConsumerClient_OnConsumeError;\r\n            _consumerClient.OnMessage += ConsumerClient_OnMessage;\r\n            _consumerClient.OnError += ConsumerClient_OnError;\r\n        }\r\n\r\nMaybe should be\r\n\r\n        private void InitKafkaClient()\r\n        {\r\n            lock (_kafkaOptions)\r\n            {\r\n                _kafkaOptions.MainConfig[\"group.id\"] = _groupId;\r\n\r\n                var config = _kafkaOptions.AsKafkaConfig();\r\n                _consumerClient = new Consumer<Null, string>(config, null, StringDeserializer);\r\n                _consumerClient.OnConsumeError += ConsumerClient_OnConsumeError;\r\n                _consumerClient.OnMessage += ConsumerClient_OnMessage;\r\n                _consumerClient.OnError += ConsumerClient_OnError;\r\n            }\r\n        }\r\n\r\nOr what have I misunderstood?"}}
{"actor":{"display_login":"s995203"}}