Exemplo n.º 1
0
        public static void Main(string[] args)
        {
            // Shows possible connection options

            //var cnInfo = new ConnectionInfo("somehost", 4222) //You can pass many hosts in a cluster as well
            //{
            //    //AutoReconnectOnFailure = true
            //    //AutoRespondToPing = true
            //    //Credentials = Credentials.Empty
            //    //PubFlushMode = PubFlushMode.Auto
            //    //RequestTimeoutMs =
            //    //SocketOptions =
            //    //Verbose = false
            //};

            var cnInfo = NatsConfig.GetConnectionInfo();

            SamplePublisher.RunAsync(cnInfo).Wait();

            //SamplePubMany.RunAsync(cnInfo).Wait(); //Can use Sample11 to measure with NATS TOP

            //SampleRequester.RunAsync(cnInfo).Wait(); //Run with Sample7

            //SamplePublisherWildcards.RunAsync(cnInfo).Wait(); // Run with Sample 8, 9

            //SamplePublisherJson.RunAsync(cnInfo).Wait(); //Run with Sample10
        }
Exemplo n.º 2
0
        public static void Main(string[] args)
        {
            var cnInfo = NatsConfig.GetConnectionInfo();

            //Subscribe using handler
            Sample1.RunAsync(cnInfo).Wait();

            //Automatic unsub after 3 messages
            //Sample2.RunAsync(cnInfo).Wait();

            //Subscribe using observer
            //Sample3.RunAsync(cnInfo).Wait();

            //Observer with exception handlers etc
            //Sample4.RunAsync(cnInfo).Wait();

            //RX, transform, filter, sampling
            //Sample5.RunAsync(cnInfo).Wait();

            //Queue groups (NEEDS two or more consumers)
            //Randomizes
            //Sample6.RunAsync(cnInfo).Wait();

            //Respond to request (NEEDS SampleRequester)
            //Sample7.RunAsync(cnInfo).Wait();

            //In-process handler subscription with wildcards
            //(NEEDS SamplePublisherWildcards) against
            //"demo.a" and "demo.b"
            //Sample8.RunAsync(cnInfo).Wait();

            //Wildcards (NEEDS SamplePublisherWildcards)
            //Sample9.RunAsync(cnInfo).Wait();

            //Consume JSON (NEEDS SamplePublisherJson)
            //Sample10.RunAsync(cnInfo).Wait();
        }