Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void PostgresNotification(object sender, NpgsqlNotificationEventArgs e)
- {
- Console.WriteLine("HELLO");
- Console.WriteLine("HELLO");
- Console.WriteLine("HELLO");
- Console.WriteLine("HELLO");
- Console.WriteLine("HELLO");
- Console.WriteLine("HELLO");
- Console.WriteLine("HELLO");
- Console.WriteLine("HELLO");
- Console.WriteLine("HELLO");
- Console.WriteLine("HELLO");
- Console.WriteLine("HELLO");
- Console.WriteLine("HELLO");
- Console.WriteLine("HELLO");
- Console.WriteLine("HELLO");
- Console.WriteLine("HELLO");
- }
- private static NpgsqlConnection _notificationConnection;
- private void StartListening()
- {
- _notificationConnection =
- new NpgsqlConnection(@"Host=35.188.31.108;Database=maniakids;Username=postgres;Password=88134165");
- _notificationConnection.Open();
- var sql = "listen mynotification";
- using (var command = new NpgsqlCommand(sql, _notificationConnection))
- {
- command.ExecuteNonQuery();
- }
- _notificationConnection.Notification +=
- PostgresNotification;
- Task.Factory.StartNew(() =>
- {
- while (true)
- _notificationConnection.Wait();
- });
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement