简体   繁体   English

Broker队列-将中毒消息移到表

[英]Broker Queue - Move Poisoned Messages to Table

Currently I have a queue that stores merge queries which are run once it is read off the queue. 当前,我有一个队列,用于存储从队列中读取后即运行的合并查询。 This all works well, and currently if there is an error with the merge the queue will disable and I have to manually remove the message (or fix the merge, as it were). 这一切都很好,目前,如果合并发生错误,队列将被禁用,我必须手动删除该消息(或解决合并问题)。

I was wondering whether it was possible to simply move the poisoned message to a table? 我想知道是否有可能将中毒的消息简单地移到桌子上? The queues run important (and different) merges that must continually run to ensure data is updated. 队列运行重要的(和不同的)合并,这些合并必须连续运行以确保更新数据。 It is not beneficial to me for the queue to, say, become disabled over night and gain a huge backlog. 例如,队列在晚上变得残障并积压了大量积压,这对我来说没有好处。

Is there any way for me to simply push the bad message into a table? 我有什么办法可以简单地将不良消息推送到表格中? I have attempted this myself however I wound up having a TRY...CATCH inside a TRANSACTION, which performs a rollback on the error anyway (thus invoking the 5 rollbacks to disable rule). 我自己尝试过此操作,但是最后我在TRANSACTION中遇到了TRY ... CATCH,无论如何都会对错误执行回滚(因此调用5个回滚来禁用规则)。 Most solutions online mention only manually removing the message. 大多数在线解决方案仅提及手动删除消息。

Any suggestions? 有什么建议么? Is this just a bad idea? 这只是一个坏主意吗? If so, why? 如果是这样,为什么?

Thanks. 谢谢。

The disable-after-5-rollbacks can be switched off by setting POISON_MESSAGE_HANDLING status to OFF in the CREATE/ALTER QUEUE statement. 可以通过在CREATE / ALTER QUEUE语句中将POISON_MESSAGE_HANDLING状态设置为OFF来关闭5后禁用禁用回滚。 You can then use TRY...CATCH to manually deal with transactions that fail. 然后,您可以使用TRY ... CATCH来手动处理失败的事务。

Like you I don't find this feature very useful, so almost always turn it off in my applications and deal with problem messages in whatever way seems best. 像您一样,我觉得此功能不是很有用,因此几乎总是在我的应用程序中将其关闭,并以看起来最好的方式处理问题消息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM