Creates a queue.
Syntax
You can use the following syntax to define a new queue:
CREATE QUEUE name QUEUE TABLE queue_table_name [ ( { option_name option_value} [, ... ] ) ]
The following section describes valid values of the option_name
and option_value
parameters.
TYPE [normal_queue | exception_queue]
RETRIES [INTEGER]
RETRYDELAY [DOUBLE PRECISION]
RETENTION [DOUBLE PRECISION]
Description
You can use the CREATE QUEUE command to create a queue in the current database if you are a superuser or a user who has the aq_administrator_role privilege.
If a queue name is schema-qualified, the queue is created in the specified schema. Otherwise, the queue is created in the current schema. A queue can only be created in the schema in which the queue table resides. A queue name must be unique in the schema.
- PolarDB for PostgreSQL(Compatible with Oracle) provides additional syntax of the CREATE QUEUE SQL command. You can use this additional syntax with the DBMS_AQADM package.
- You can use the DROP QUEUE command to delete a queue.
Parameters
Parameter | Description |
---|---|
name | The name of the sequence to be created. The name can be schema-qualified. |
queue_table_name | The name of the queue table that is associated with the queue. |
option_name option_value | The names and values of options that are associated with the new queue. If the call to the CREATE QUEUE TABLE includes duplicate option names, the server returns an error. The following section describes valid values of these two parameters:
|
Example
Run the following command to create a queue named work_order that is associated with the queue table named work_order_table:
CREATE QUEUE work_order QUEUE TABLE work_order_table (RETRIES 5, RETRYDELAY 2);
The server allows five attempts to delete messages from the queue and requires an interval of 2 seconds between two retry attempts.