コード例 #1
0
    public void Processor(CancellationToken token)
    {
        Subsriber <Message> subsriber = new Subsriber <Message>()
        {
            Interval = 1000
        };

        subsriber.Callback(Process, m => m != null);
    }
コード例 #2
0
 public void StartListeningForMessages()
 {
 
     Subsriber<Message> subsriber = new Subsriber<Message>()
     {
         Interval = 1000
     };
     subsriber.Callback(Process, m => m != null);
     
     }
コード例 #3
0
        static void Main(string[] args)
        {
            var channel    = new Channel("127.0.0.1:50052", ChannelCredentials.Insecure);
            var subscriber = new Subsriber(new PubSub.PubSubClient(channel));

            Task.Run(async() =>
            {
                await subscriber.Subscribe();
            }).GetAwaiter();

            Console.WriteLine("Hit key to unsubscribe");
            Console.ReadLine();

            subscriber.Unsubscribe();

            Console.WriteLine("Unsubscribed...");

            Console.WriteLine("Hit key to exit...");
            Console.ReadLine();
        }