{"action":"created","issue":{"url":"https://api.github.com/repos/hazelcast/hazelcast-csharp-client/issues/172","repository_url":"https://api.github.com/repos/hazelcast/hazelcast-csharp-client","labels_url":"https://api.github.com/repos/hazelcast/hazelcast-csharp-client/issues/172/labels{/name}","comments_url":"https://api.github.com/repos/hazelcast/hazelcast-csharp-client/issues/172/comments","events_url":"https://api.github.com/repos/hazelcast/hazelcast-csharp-client/issues/172/events","html_url":"https://github.com/hazelcast/hazelcast-csharp-client/issues/172","id":339244168,"node_id":"MDU6SXNzdWUzMzkyNDQxNjg=","number":172,"title":"No way to get IHazelcastClient Status ?","user":{"login":"tebeco","id":2266487,"node_id":"MDQ6VXNlcjIyNjY0ODc=","avatar_url":"https://avatars0.githubusercontent.com/u/2266487?v=4","gravatar_id":"","url":"https://api.github.com/users/tebeco","html_url":"https://github.com/tebeco","followers_url":"https://api.github.com/users/tebeco/followers","following_url":"https://api.github.com/users/tebeco/following{/other_user}","gists_url":"https://api.github.com/users/tebeco/gists{/gist_id}","starred_url":"https://api.github.com/users/tebeco/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tebeco/subscriptions","organizations_url":"https://api.github.com/users/tebeco/orgs","repos_url":"https://api.github.com/users/tebeco/repos","events_url":"https://api.github.com/users/tebeco/events{/privacy}","received_events_url":"https://api.github.com/users/tebeco/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2018-07-08T17:51:40Z","updated_at":"2018-07-10T09:50:33Z","closed_at":null,"author_association":"NONE","body":"In order to get a healthchack on the `HazelcastClient` i'm trying to monitor the connection to the cluster.\r\nThe only way i found is :\r\n\r\n```\r\n            _hazelcastInstance =HazelcastClient.NewHazelcastClient(clientConfig);\r\n            _hazelcastInstance.GetLifecycleService().AddLifecycleListener(new LifecycleListener((e) =>\r\n            {\r\n                hzHealthCheck.IsClientConnected = (e.GetState() == LifecycleEvent.LifecycleState.ClientConnected);\r\n            }));\r\n```\r\nThis looks fine but it is kinda stupid since the client attempt to connect on this line :\r\n\r\n```\r\n            _hazelcastInstance =HazelcastClient.NewHazelcastClient(clientConfig);\r\n```\r\nAnd the cluster could be up or down it will never raise the event ... so until a real event happens the healthcheck would be useless right ?\r\n\r\n@asimarslan @cangencer not sure if there are better place to look for that info elsewhere"},"comment":{"url":"https://api.github.com/repos/hazelcast/hazelcast-csharp-client/issues/comments/403766400","html_url":"https://github.com/hazelcast/hazelcast-csharp-client/issues/172#issuecomment-403766400","issue_url":"https://api.github.com/repos/hazelcast/hazelcast-csharp-client/issues/172","id":403766400,"node_id":"MDEyOklzc3VlQ29tbWVudDQwMzc2NjQwMA==","user":{"login":"sancar","id":570462,"node_id":"MDQ6VXNlcjU3MDQ2Mg==","avatar_url":"https://avatars0.githubusercontent.com/u/570462?v=4","gravatar_id":"","url":"https://api.github.com/users/sancar","html_url":"https://github.com/sancar","followers_url":"https://api.github.com/users/sancar/followers","following_url":"https://api.github.com/users/sancar/following{/other_user}","gists_url":"https://api.github.com/users/sancar/gists{/gist_id}","starred_url":"https://api.github.com/users/sancar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sancar/subscriptions","organizations_url":"https://api.github.com/users/sancar/orgs","repos_url":"https://api.github.com/users/sancar/repos","events_url":"https://api.github.com/users/sancar/events{/privacy}","received_events_url":"https://api.github.com/users/sancar/received_events","type":"User","site_admin":false},"created_at":"2018-07-10T09:50:33Z","updated_at":"2018-07-10T09:50:33Z","author_association":"MEMBER","body":"> i still wonder why not raisin the event ?\r\n\r\nIt should raise the event. Are you asking why it did not raise the event before when you add the listener after instance crated ?\r\n\r\n> also why using a static factory instead of a constructor\r\n\r\nThis way all API entry points are gathered in single point. When you say \"HazelcastClient.\" , your ide shows all the things that you can do. Creating a map from hazelcast is also same. We could have done\r\n`new IMap(hazelcastClient, mapName)`\r\nBut  we choose to do\r\n`hazelcastClient.getMap(\"mapNaoe\")`\r\n\r\nAlso with static context, we can keep track of all the clients started and give API like `shutdownAll` \r\n\r\nIn the end, it is a matter of taste. We could have choose the other way around. \r\n\r\n> since trying to create mock over public static Stuff X() is kinda hard\r\n\r\nI did not get why it cause you trouble though. Which class are you trying to mock ?"}}
{"actor":{"display_login":"sancar"}}