Exemplo n.º 1
0
        public async Task CreateWithProperties()
        {
            TestMqServer server = new TestMqServer();

            server.Initialize(41206);
            server.Start();

            TmqClient client = new TmqClient();
            await client.ConnectAsync("tmq://localhost:41206");

            Assert.True(client.IsConnected);

            TmqResponseCode created = await client.CreateChannel("new-channel", o =>
            {
                o.AllowMultipleQueues   = false;
                o.SendOnlyFirstAcquirer = true;
                o.AcknowledgeTimeout    = TimeSpan.FromSeconds(33);
                o.Status = MessagingQueueStatus.Pull;
            });

            Assert.Equal(TmqResponseCode.Ok, created);

            Channel found = server.Server.FindChannel("new-channel");

            Assert.NotNull(found);
            Assert.False(found.Options.AllowMultipleQueues);
            Assert.True(found.Options.SendOnlyFirstAcquirer);
        }
Exemplo n.º 2
0
        public async Task Create(bool verifyResponse)
        {
            int          port   = verifyResponse ? 35905 : 35904;
            TestMqServer server = new TestMqServer();

            server.Initialize(port);
            server.Start();

            TmqClient client = new TmqClient();

            client.Connect("tmq://localhost:" + port);

            TmqResponseCode created = await client.CreateChannel("new-channel", verifyResponse);

            if (verifyResponse)
            {
                Assert.Equal(TmqResponseCode.Ok, created);
            }
            else
            {
                await Task.Delay(1000);

                Assert.Equal(TmqResponseCode.Ok, created);
            }
        }