diff --git a/Directory.Build.props b/Directory.Build.props index da5f8cc..fe7cd8c 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -1,12 +1,14 @@ 0.4.0 + net6.0 latest Oleksandr Poliakov RabbitMQ;Messaging MIT git true + true An experimental low-level RabbitMQ client for .Net with number of high-level APIs diff --git a/docs/examples/RabbitMQ.Next.Examples.DemoSaslAuthMechanism/RabbitMQ.Next.Examples.DemoSaslAuthMechanism.csproj b/docs/examples/RabbitMQ.Next.Examples.DemoSaslAuthMechanism/RabbitMQ.Next.Examples.DemoSaslAuthMechanism.csproj index 125bf9d..fbbb2ec 100644 --- a/docs/examples/RabbitMQ.Next.Examples.DemoSaslAuthMechanism/RabbitMQ.Next.Examples.DemoSaslAuthMechanism.csproj +++ b/docs/examples/RabbitMQ.Next.Examples.DemoSaslAuthMechanism/RabbitMQ.Next.Examples.DemoSaslAuthMechanism.csproj @@ -2,7 +2,6 @@ Exe - net6.0 false diff --git a/docs/examples/RabbitMQ.Next.Examples.DynamicSerializer/RabbitMQ.Next.Examples.DynamicSerializer.csproj b/docs/examples/RabbitMQ.Next.Examples.DynamicSerializer/RabbitMQ.Next.Examples.DynamicSerializer.csproj index 073d76e..69be4c1 100644 --- a/docs/examples/RabbitMQ.Next.Examples.DynamicSerializer/RabbitMQ.Next.Examples.DynamicSerializer.csproj +++ b/docs/examples/RabbitMQ.Next.Examples.DynamicSerializer/RabbitMQ.Next.Examples.DynamicSerializer.csproj @@ -2,7 +2,6 @@ Exe - net6.0 false diff --git a/docs/examples/RabbitMQ.Next.Examples.SimpleConsumer/RabbitMQ.Next.Examples.SimpleConsumer.csproj b/docs/examples/RabbitMQ.Next.Examples.SimpleConsumer/RabbitMQ.Next.Examples.SimpleConsumer.csproj index ec05c4f..7ec2d33 100644 --- a/docs/examples/RabbitMQ.Next.Examples.SimpleConsumer/RabbitMQ.Next.Examples.SimpleConsumer.csproj +++ b/docs/examples/RabbitMQ.Next.Examples.SimpleConsumer/RabbitMQ.Next.Examples.SimpleConsumer.csproj @@ -2,7 +2,6 @@ Exe - net6.0 false diff --git a/docs/examples/RabbitMQ.Next.Examples.SimplePublisher/RabbitMQ.Next.Examples.SimplePublisher.csproj b/docs/examples/RabbitMQ.Next.Examples.SimplePublisher/RabbitMQ.Next.Examples.SimplePublisher.csproj index 78913de..f8a3edc 100644 --- a/docs/examples/RabbitMQ.Next.Examples.SimplePublisher/RabbitMQ.Next.Examples.SimplePublisher.csproj +++ b/docs/examples/RabbitMQ.Next.Examples.SimplePublisher/RabbitMQ.Next.Examples.SimplePublisher.csproj @@ -2,7 +2,6 @@ Exe - net6.0 false diff --git a/docs/examples/RabbitMQ.Next.Examples.TopologyBuilder/RabbitMQ.Next.Examples.TopologyBuilder.csproj b/docs/examples/RabbitMQ.Next.Examples.TopologyBuilder/RabbitMQ.Next.Examples.TopologyBuilder.csproj index e1902fb..39cbcea 100644 --- a/docs/examples/RabbitMQ.Next.Examples.TopologyBuilder/RabbitMQ.Next.Examples.TopologyBuilder.csproj +++ b/docs/examples/RabbitMQ.Next.Examples.TopologyBuilder/RabbitMQ.Next.Examples.TopologyBuilder.csproj @@ -2,7 +2,6 @@ Exe - net6.0 false diff --git a/src/RabbitMQ.Next.Abstractions/RabbitMQ.Next.Abstractions.csproj b/src/RabbitMQ.Next.Abstractions/RabbitMQ.Next.Abstractions.csproj index 7baeab3..e9289f3 100644 --- a/src/RabbitMQ.Next.Abstractions/RabbitMQ.Next.Abstractions.csproj +++ b/src/RabbitMQ.Next.Abstractions/RabbitMQ.Next.Abstractions.csproj @@ -1,7 +1,6 @@ - net6.0 RabbitMQ.Next RabbitMQ.Next.Abstractions diff --git a/src/RabbitMQ.Next.Consumer.Abstractions/RabbitMQ.Next.Consumer.Abstractions.csproj b/src/RabbitMQ.Next.Consumer.Abstractions/RabbitMQ.Next.Consumer.Abstractions.csproj index 1228e86..e2f6a77 100644 --- a/src/RabbitMQ.Next.Consumer.Abstractions/RabbitMQ.Next.Consumer.Abstractions.csproj +++ b/src/RabbitMQ.Next.Consumer.Abstractions/RabbitMQ.Next.Consumer.Abstractions.csproj @@ -1,7 +1,6 @@ - net6.0 RabbitMQ.Next.Consumer RabbitMQ.Next.Consumer.Abstractions diff --git a/src/RabbitMQ.Next.Consumer/RabbitMQ.Next.Consumer.csproj b/src/RabbitMQ.Next.Consumer/RabbitMQ.Next.Consumer.csproj index 6fc13fb..3191bc6 100644 --- a/src/RabbitMQ.Next.Consumer/RabbitMQ.Next.Consumer.csproj +++ b/src/RabbitMQ.Next.Consumer/RabbitMQ.Next.Consumer.csproj @@ -1,7 +1,6 @@ - net6.0 RabbitMQ.Next.Consumer diff --git a/src/RabbitMQ.Next.Publisher.Abstractions/RabbitMQ.Next.Publisher.Abstractions.csproj b/src/RabbitMQ.Next.Publisher.Abstractions/RabbitMQ.Next.Publisher.Abstractions.csproj index a0f17a2..c801a30 100644 --- a/src/RabbitMQ.Next.Publisher.Abstractions/RabbitMQ.Next.Publisher.Abstractions.csproj +++ b/src/RabbitMQ.Next.Publisher.Abstractions/RabbitMQ.Next.Publisher.Abstractions.csproj @@ -1,7 +1,6 @@ - net6.0 RabbitMQ.Next.Publisher RabbitMQ.Next.Publisher.Abstractions diff --git a/src/RabbitMQ.Next.Publisher.Attributes/RabbitMQ.Next.Publisher.Attributes.csproj b/src/RabbitMQ.Next.Publisher.Attributes/RabbitMQ.Next.Publisher.Attributes.csproj index 4e5b64a..e69dbce 100644 --- a/src/RabbitMQ.Next.Publisher.Attributes/RabbitMQ.Next.Publisher.Attributes.csproj +++ b/src/RabbitMQ.Next.Publisher.Attributes/RabbitMQ.Next.Publisher.Attributes.csproj @@ -1,7 +1,6 @@ - net6.0 RabbitMQ.Next.Publisher.Attributes diff --git a/src/RabbitMQ.Next.Publisher/RabbitMQ.Next.Publisher.csproj b/src/RabbitMQ.Next.Publisher/RabbitMQ.Next.Publisher.csproj index f084a0e..5eef764 100644 --- a/src/RabbitMQ.Next.Publisher/RabbitMQ.Next.Publisher.csproj +++ b/src/RabbitMQ.Next.Publisher/RabbitMQ.Next.Publisher.csproj @@ -1,7 +1,6 @@ - net6.0 RabbitMQ.Next.Publisher diff --git a/src/RabbitMQ.Next.Serialization.Dynamic/RabbitMQ.Next.Serialization.Dynamic.csproj b/src/RabbitMQ.Next.Serialization.Dynamic/RabbitMQ.Next.Serialization.Dynamic.csproj index 78c0a65..93ee36c 100644 --- a/src/RabbitMQ.Next.Serialization.Dynamic/RabbitMQ.Next.Serialization.Dynamic.csproj +++ b/src/RabbitMQ.Next.Serialization.Dynamic/RabbitMQ.Next.Serialization.Dynamic.csproj @@ -1,7 +1,6 @@ - net6.0 RabbitMQ.Next.Serialization.Dynamic diff --git a/src/RabbitMQ.Next.Serialization.MessagePack/RabbitMQ.Next.Serialization.MessagePack.csproj b/src/RabbitMQ.Next.Serialization.MessagePack/RabbitMQ.Next.Serialization.MessagePack.csproj index 1b80eb0..a274593 100644 --- a/src/RabbitMQ.Next.Serialization.MessagePack/RabbitMQ.Next.Serialization.MessagePack.csproj +++ b/src/RabbitMQ.Next.Serialization.MessagePack/RabbitMQ.Next.Serialization.MessagePack.csproj @@ -1,7 +1,6 @@ - net6.0 RabbitMQ.Next.Serialization.MessagePack diff --git a/src/RabbitMQ.Next.Serialization.NewtonsoftJson/RabbitMQ.Next.Serialization.NewtonsoftJson.csproj b/src/RabbitMQ.Next.Serialization.NewtonsoftJson/RabbitMQ.Next.Serialization.NewtonsoftJson.csproj index 10a69d5..7f0c9bb 100644 --- a/src/RabbitMQ.Next.Serialization.NewtonsoftJson/RabbitMQ.Next.Serialization.NewtonsoftJson.csproj +++ b/src/RabbitMQ.Next.Serialization.NewtonsoftJson/RabbitMQ.Next.Serialization.NewtonsoftJson.csproj @@ -1,7 +1,6 @@ - net6.0 RabbitMQ.Next.Serialization.NewtonsoftJson diff --git a/src/RabbitMQ.Next.Serialization.PlainText/RabbitMQ.Next.Serialization.PlainText.csproj b/src/RabbitMQ.Next.Serialization.PlainText/RabbitMQ.Next.Serialization.PlainText.csproj index f892c97..04ced7c 100644 --- a/src/RabbitMQ.Next.Serialization.PlainText/RabbitMQ.Next.Serialization.PlainText.csproj +++ b/src/RabbitMQ.Next.Serialization.PlainText/RabbitMQ.Next.Serialization.PlainText.csproj @@ -1,7 +1,6 @@ - net6.0 RabbitMQ.Next.Serialization.PlainText diff --git a/src/RabbitMQ.Next.Serialization.SystemJson/RabbitMQ.Next.Serialization.SystemJson.csproj b/src/RabbitMQ.Next.Serialization.SystemJson/RabbitMQ.Next.Serialization.SystemJson.csproj index 2780d71..3522270 100644 --- a/src/RabbitMQ.Next.Serialization.SystemJson/RabbitMQ.Next.Serialization.SystemJson.csproj +++ b/src/RabbitMQ.Next.Serialization.SystemJson/RabbitMQ.Next.Serialization.SystemJson.csproj @@ -1,7 +1,6 @@ - net6.0 RabbitMQ.Next.Serialization.SystemJson diff --git a/src/RabbitMQ.Next.TopologyBuilder.Abstractions/RabbitMQ.Next.TopologyBuilder.Abstractions.csproj b/src/RabbitMQ.Next.TopologyBuilder.Abstractions/RabbitMQ.Next.TopologyBuilder.Abstractions.csproj index f86f48b..640e6ae 100644 --- a/src/RabbitMQ.Next.TopologyBuilder.Abstractions/RabbitMQ.Next.TopologyBuilder.Abstractions.csproj +++ b/src/RabbitMQ.Next.TopologyBuilder.Abstractions/RabbitMQ.Next.TopologyBuilder.Abstractions.csproj @@ -1,7 +1,6 @@ - net6.0 RabbitMQ.Next.TopologyBuilder.Abstractions RabbitMQ.Next.TopologyBuilder diff --git a/src/RabbitMQ.Next.TopologyBuilder/RabbitMQ.Next.TopologyBuilder.csproj b/src/RabbitMQ.Next.TopologyBuilder/RabbitMQ.Next.TopologyBuilder.csproj index 6a84e49..56c0e6f 100644 --- a/src/RabbitMQ.Next.TopologyBuilder/RabbitMQ.Next.TopologyBuilder.csproj +++ b/src/RabbitMQ.Next.TopologyBuilder/RabbitMQ.Next.TopologyBuilder.csproj @@ -1,7 +1,6 @@ - net6.0 RabbitMQ.Next.TopologyBuilder diff --git a/src/RabbitMQ.Next/Connection.cs b/src/RabbitMQ.Next/Connection.cs index 9faff0f..f036679 100644 --- a/src/RabbitMQ.Next/Connection.cs +++ b/src/RabbitMQ.Next/Connection.cs @@ -132,6 +132,7 @@ private void SendLoop() { var heartbeatMemory = new MemoryAccessor(ProtocolConstants.HeartbeatFrame); var socketChannel = this.socketSender.Reader; + do { while (socketChannel.TryRead(out var memory)) @@ -146,19 +147,19 @@ private void SendLoop() } } - var waitResult = socketChannel.WaitToReadAsync().Wait(this.connectionDetails.HeartbeatInterval); - if (waitResult.IsCompleted) + if (socketChannel.WaitToReadAsync().Wait(this.connectionDetails.HeartbeatInterval, out var canRead)) { - if (waitResult.Result) + if (!canRead) { - continue; + return; } - - break; + } + else + { + // wait long enough and nothing was sent, need to send heartbeat frame + this.socket.Send(heartbeatMemory); } - // wait long enough and nothing was sent, need to send heartbeat frame - this.socket.Send(heartbeatMemory); } while (true); } diff --git a/src/RabbitMQ.Next/RabbitMQ.Next.csproj b/src/RabbitMQ.Next/RabbitMQ.Next.csproj index 27d7bfd..4079a8a 100644 --- a/src/RabbitMQ.Next/RabbitMQ.Next.csproj +++ b/src/RabbitMQ.Next/RabbitMQ.Next.csproj @@ -1,18 +1,13 @@ - net6.0;net7.0 RabbitMQ.Next - + - - - - diff --git a/src/RabbitMQ.Next/Tasks/TaskExtensions.cs b/src/RabbitMQ.Next/Tasks/TaskExtensions.cs index 9aba8da..8f474de 100644 --- a/src/RabbitMQ.Next/Tasks/TaskExtensions.cs +++ b/src/RabbitMQ.Next/Tasks/TaskExtensions.cs @@ -5,11 +5,12 @@ namespace RabbitMQ.Next.Tasks; public static class TaskExtensions { - public static (bool IsCompleted, T Result) Wait(this ValueTask valueTask, TimeSpan? timeout) + public static bool Wait(this ValueTask valueTask, TimeSpan? timeout, out T result) { if (valueTask.IsCompleted) { - return (true, valueTask.Result); + result = valueTask.Result; + return true; } var task = valueTask.AsTask(); @@ -21,9 +22,11 @@ public static (bool IsCompleted, T Result) Wait(this ValueTask valueTask, if (task.Wait(timeoutMs)) { - return (true, task.Result); + result = task.Result; + return true; } - return (false, default); + result = default; + return false; } } diff --git a/tests/RabbitMQ.Next.Tests/RabbitMQ.Next.Tests.csproj b/tests/RabbitMQ.Next.Tests/RabbitMQ.Next.Tests.csproj index 7766273..672d14f 100644 --- a/tests/RabbitMQ.Next.Tests/RabbitMQ.Next.Tests.csproj +++ b/tests/RabbitMQ.Next.Tests/RabbitMQ.Next.Tests.csproj @@ -1,7 +1,6 @@ - net6.0;net7.0 false