EasyNetQ手动确认

时间:2019-05-29 16:37:02

标签: c# rabbitmq easynetq

我有一个由多个客户端使用的队列,我希望只有特定的客户端对定向到他的味精执行确认,然后如何禁用自动确认并手动执行呢?

            bus.Subscribe<MessageModel>(string.Empty, message =>
            {
                // if a message sent by this machine
                // if not a message directed to this machine
                // then ignore it
                if (message.MachineName == this.MachineName || message.MachineNameDest != this.MachineName)
                    return;

                // if the same message already received but still not removed from the queue
                // then ignore it
                if (message.ID == LastMessageReceived?.ID)
                    return;

                LastMessageReceived = message;

                MessageEventArgs handler = new MessageEventArgs(message);
                Received?.Invoke(this, handler);

                RemoveMessage(message); // <--- how manual ack ???

            }, cfg => cfg.WithAutoDelete(false)
            .WithQueueName(queueName));



谢谢。

0 个答案:

没有答案