public async Task Remove(bool verifyResponse) { int port = 41208 + Convert.ToInt32(verifyResponse); TestMqServer server = new TestMqServer(); server.Initialize(port); server.Start(); Channel channel = server.Server.FindChannel("ch-route"); Assert.NotNull(channel); ChannelQueue queue = channel.FindQueue(MessageA.ContentType); Assert.NotNull(queue); TmqAdminClient client = new TmqAdminClient(); await client.ConnectAsync("tmq://localhost:" + port); Assert.True(client.IsConnected); TmqResponseCode done = await client.RemoveQueue("ch-route", MessageA.ContentType, verifyResponse); Assert.Equal(TmqResponseCode.Ok, done); if (!verifyResponse) { await Task.Delay(500); } queue = channel.FindQueue(MessageA.ContentType); Assert.Null(queue); }
public async Task Update() { TestMqServer server = new TestMqServer(); server.Initialize(41207); server.Start(); Channel channel = server.Server.FindChannel("ch-route"); Assert.NotNull(channel); ChannelQueue queue = channel.FindQueue(MessageA.ContentType); Assert.NotNull(queue); Assert.False(queue.Options.WaitForAcknowledge); Assert.False(queue.Options.SendOnlyFirstAcquirer); Assert.Equal(TimeSpan.FromSeconds(12), queue.Options.MessageTimeout); TmqAdminClient client = new TmqAdminClient(); await client.ConnectAsync("tmq://localhost:41207"); Assert.True(client.IsConnected); TmqResponseCode updated = await client.SetQueueOptions("ch-route", MessageA.ContentType, o => { o.WaitForAcknowledge = true; o.MessageTimeout = TimeSpan.FromSeconds(666); o.SendOnlyFirstAcquirer = true; }); Assert.Equal(TmqResponseCode.Ok, updated); Assert.True(queue.Options.WaitForAcknowledge); Assert.True(queue.Options.SendOnlyFirstAcquirer); Assert.Equal(TimeSpan.FromSeconds(666), queue.Options.MessageTimeout); }