且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何从消息队列中删除消息(仅当其良好的格式化)?

更新时间:2023-11-25 12:44:16

这是同样的方法,我走的时候手动出队的消息一次,我还没有遇到任何问题随之而来。

This is the same approach that I take when manually dequeuing message one at a time and I've not come across any issues with it.

这是你似乎不处理的一件事是如何处理的消息在不具备所要求的格式的队列。是你打算把它留在队列中?如果是这样,你可能最终得到一个非常大的队列,并有各种各样的问题,在消息还偷看了尚未得到预期的队列中。它似乎更有意义,也去排队,那些不具有所需格式的报文和其他地方存放他们,如果他们不能被删除。

The one thing that you do not appear to dealing with is how to handle a message on the queue that does not have the required format. Is your intention to leave it on the queue? If so, you might end up with a very large queue and have all sorts of issues with peeking at messages further up the queue that have not yet been expected. It would appear to make more sense to also de-queue those messages that do not have the required format and store them elsewhere if they cannot be deleted.