gpt4 book ai didi

java - Oracle Advanced Queue - 出队后删除消息

转载 作者:行者123 更新时间:2023-11-29 04:57:24 26 4
gpt4 key购买 nike

我们使用 Oracle JMS API 从高级队列中读取消息。我们使用以下代码从队列中读取消息:

    MessageConsumer consumer = sess.createConsumer(q);


for (Message m; (m = consumer.receive()) != null;)
{
new Timer().schedule(new QueueExample(m), 0);
}

问题是,消息从队列中收到后,并没有完全从队列表中删除,只是STATE字段从0变成了2。这是Oracle JMS Client的默认行为吗?在使用 consumer.receive() 方法从队列中读取消息后,我们希望从队列表中完全删除记录。什么是合适的 api 方法来做到这一点?

最佳答案

我认为您遇到这种情况是因为您队列上的retention_time 参数被配置为某个高值。

保留用于:

Users can specify that messages be retained after consumption. The systems administrator can specify the duration for which messages will be retained. Oracle AQ stores information about the history of each message, preserving the queue and message properties of delay, expiration, and retention for messages destined for local or remote recipients. The information contains the ENQUEUE/DEQUEUE time and the identification of the transaction that executed each request. This allows users to keep a history of relevant messages. The history can be used for tracking, data warehouse and data mining operations.

您可以通过检查队列创建脚本并通过管理界面或使用 ALTER_QUEUE 更改设置来验证这一点。

关于java - Oracle Advanced Queue - 出队后删除消息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33257174/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com