Exemplo n.º 1
0
        public async Task Test2()
        {
            var port    = 4222;
            var subPort = 8222;

            using var container = Containers.CreateNatsStreamingContainer(port, subPort);

            container.Start();

            await Task.Delay(1000); //StartingNats

            var connectionConfiguration = new NatsStreamingConnectionConfigurationBuilder()
                                          .WithClusterId("test-cluster")
                                          .WithNatsUrl($"http://localhost:{port}/")
                                          .Build();

            var factory = new NatsStreamingConsumerFactory(connectionConfiguration);

            var natsConsumer = new NatsConsumer("test", "test", factory);

            Action act = () => natsConsumer.Connect();

            act.Should().NotThrow();
        }