We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Example:
public static async Task Main(string[] args) { var factory = new ConnectionFactory() { HostName = "localhost" }; using var connection = factory.CreateConnection(); var channel = connection.CreateModel(); channel.QueueDeclare(queue: "task_queue", exclusive: false, autoDelete: false); var message = "Hello"; var body = Encoding.UTF8.GetBytes(message); // restart rmq service here while (true) { try { var properties = channel.CreateBasicProperties(); channel.BasicPublish(exchange: "", routingKey: "task_queue", basicProperties: properties, body: body); Console.WriteLine(" [x] Sent {0}", message); } catch (Exception ex) { Console.WriteLine(ex.ToString()); break; } await Task.Delay(1000); } Console.WriteLine($"IsClosed:{channel.IsClosed}"); channel.Dispose(); Console.WriteLine($"IsClosed:{channel.IsClosed}"); } // [x] Sent Hello // ... // RabbitMQ.Client.Exceptions.AlreadyClosedException: Already closed: The AMQP operation was interrupted: AMQP close-reason, initiated by Peer, code=320, text='CONNECTION_FORCED - broker forced connection closure // // with reason 'shutdown'', classId=0, methodId=0 // at RabbitMQ.Client.Impl.SessionBase.Transmit(OutgoingCommand& cmd) // at RabbitMQ.Client.Impl.ModelBase.ModelSend(MethodBase method, ContentHeaderBase header, ReadOnlyMemory`1 body) // at RabbitMQ.Client.Framing.Impl.Model._Private_BasicPublish(String exchange, String routingKey, Boolean mandatory, IBasicProperties basicProperties, ReadOnlyMemory`1 body) // at RabbitMQ.Client.Impl.ModelBase.BasicPublish(String exchange, String routingKey, Boolean mandatory, IBasicProperties basicProperties, ReadOnlyMemory`1 body) // at RabbitMQ.Client.Impl.AutorecoveringModel.BasicPublish(String exchange, String routingKey, Boolean mandatory, IBasicProperties basicProperties, ReadOnlyMemory`1 body) // IsClosed:True // IsClosed:False
Is this the correct behavior?
The text was updated successfully, but these errors were encountered:
You are supposed to close the channel before disposing it but I guess as a usability improvement we can update the state, too.
According to the stack trace the node was forced to shut down, so there may be connection recovery side effects at play.
Sorry, something went wrong.
Add test that demonstrates the current behavior of a recovered channe…
48065f9
…l that is disposed. Fixes #1086
lukebakken
Successfully merging a pull request may close this issue.
Example:
Is this the correct behavior?
The text was updated successfully, but these errors were encountered: