I would like to set a timeout after which an error message is automatically sent.
When I delete a message, I wait until it is transmitted through the socket, and the other side confirms its receipt.
Do I need to keep a list of timers, or can RMQ handle this automatically?
private void Run() { _rmqConnection = _queueConnectionFactory.CreateFactory().CreateConnection(); _rmqReadchannel = _rmqConnection.CreateModel(); _rmqReadchannel.QueueDeclare(QueueIdOutgoing(), true, false, false, null); _rmqReadchannel.BasicQos(0, 1, false); var consumer = new QueueingBasicConsumer(_rmqReadchannel); _rmqReadchannel.BasicConsume(QueueIdOutgoing(), false, consumer); while (true) { if (!_rmqReadchannel.IsOpen) { throw new Exception("Channel is closed"); } var ea = consumer.Queue.Dequeue(); string jsonData = Encoding.UTF8.GetString(ea.Body); if (OnOutgoingMessageReady != null) { OnOutgoingMessageReady(this, new QueueDataEventArgs(jsonData, ea.DeliveryTag)); }
source share