Oracle AQ出队顺序 [英] Oracle AQ dequeue order

查看:193
本文介绍了Oracle AQ出队顺序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Oracle 10g中的触发器为常规表中的行的子集生成upsert和删除消息.这些消息包含两个字段:

A trigger in an Oracle 10g generates upsert and delete messages for a subset of rows in a regular table. These messages consist out of two fields:

  • 唯一的行ID.
  • 非唯一ID.

在使用这些消息时,我想在双端队列过程中强加一个要遵守以下约束的命令:

When consuming these message I want to impose an order on the deque process that respects the following constraints:

  • 消息必须按插入顺序出队.
  • 属于同一ID的消息必须以这种方式出队,以使其他任何出队过程都不能使具有该ID的潜在后继消息(或多条消息)出队.由于消息是使用触发器生成的,因此我不能为此使用组.

我将Oracle Java接口用于AQ.关于如何实现的任何指示?

I am using the Oracle Java interface for AQ. Any pointers on how that could be achieved?

推荐答案

我认为默认的出队顺序是先进先出,因此将按照与入队相同的顺序出队.

The default dequeue order I believe is first in first out, therefore they will be dequeued in the same order they were enqueued.

对于第二点,您是说要序列化非唯一ID上的出队吗?即,您的队列中基本上有许多队列,并且您只希望一项工作可以随时消耗每个队列中的消息?

For your second point, are you saying that you want to serialize dequeue on the non-unique-id? Ie, you basically have many queues within your queue, and you only want one job to consume messages form each queue at any one time?

即,您收到消息:

1 | a
2 | a
3 | b
4 | a

在这里,您有两种记录类型(a和b),并且您想要1个作业消耗所有a,而另一个消耗所有b.如果是这种情况,可以考虑创建多个队列吗?

Here you have two types of record (a and b) and you want 1 job to consume all the a's and another to consume all the b's. If that is the case consider creating multiple queues perhaps?

如果多个队列失败,请查看传递给出队过程的dequeue_options_t类型-最值得注意的是dequeue_condition-这仅允许您选择特定的消息,因此您可以为所有a开始一个工作,为所有a开始另一个工作b等.

Failing multiple queues, have a look at the dequeue_options_t type that you pass to the dequeue procedure - most notably dequeue_condition - this allows you to select only specific messages, so you could start a job for all the a's and another for all the b's etc.

这篇关于Oracle AQ出队顺序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆