@@ -15,10 +15,6 @@ receiving of various payloads, such as RAW values, JSON, JMS, and objects.
1515Transactional Event Queues use a highly optimized implementation of Advanced
1616Queuing. They were previously called AQ Sharded Queues.
1717
18- .. note ::
19-
20- TxEventQ and AQ Classic queues are only supported in python-oracledb Thick
21- mode. See :ref: `enablingthick `.
2218
2319Python-oracledb API calls are the same for Transactional Event Queues and
2420Classic Queues, however there are differences in support for some payload
@@ -31,11 +27,18 @@ types.
3127- The JSON payload requires Oracle Client libraries 21c (or later) and Oracle
3228 Database 21c (or later).
3329
34- There are examples of AQ Classic Queues in the `GitHub examples
30+ JSON and JMS payloads, array message queuing and dequeuing operations, and
31+ :ref: `Recipient Lists <reciplists >` are only supported in python-oracledb
32+ :ref: `Thick mode <enablingthick >`.
33+
34+ There are examples of AQ Classic Queues in the `GitHub samples
3535<https://github.com/oracle/python-oracledb/tree/main/samples> `__ directory.
3636
3737**Transactional Event Queue Support **
3838
39+ Transactional Event Queues are only supported in python-oracledb :ref: `Thick
40+ mode <enablingthick>`.
41+
3942- RAW and named Oracle object payloads are supported for single and array
4043 message enqueuing and dequeuing when using Oracle Client 19c (or later) and
4144 connected to Oracle Database 19c (or later).
@@ -55,7 +58,15 @@ Creating a Queue
5558
5659Before being used in applications, queues need to be created in the database.
5760
58- **Using RAW Payloads **
61+ To experiment with queueing, you can grant yourself privileges, for example in
62+ SQL*Plus as a DBA user:
63+
64+ .. code-block :: sql
65+
66+ grant aq_administrator_role, aq_user_role to &&username;
67+ grant execute on dbms_aq to &&username;
68+
69+ **Creating RAW Payload Queues **
5970
6071To use SQL*Plus to create a Classic Queue for the RAW payload which is suitable
6172for sending string or bytes messages:
@@ -79,7 +90,7 @@ To create a Transactional Event Queue for RAW payloads:
7990 end;
8091 /
8192
82- **Using JSON Payloads **
93+ **Creating JSON Payload Queues **
8394
8495Queues can also be created for JSON payloads. For example, to create a Classic
8596Queue in SQL*Plus:
@@ -99,7 +110,7 @@ Enqueuing Messages
99110To send messages in Python, you connect and get a :ref: `queue <queue >`. The
100111queue can then be used for enqueuing, dequeuing, or for both.
101112
102- **Using RAW Payloads **
113+ **Enqueuing RAW Payloads **
103114
104115You can connect to the database and get the queue that was created with RAW
105116payload type by using:
@@ -123,13 +134,14 @@ messages:
123134 connection.commit()
124135
125136 Since the queue is a RAW queue, strings are internally encoded to bytes using
126- ``message.encode() `` before being enqueued.
137+ `encode() <https://docs.python.org/3/library/stdtypes.html#str.encode >`__
138+ before being enqueued.
127139
128- The use of :meth: `~Connection.commit() ` means that messages are sent only when
129- any database transaction related to them is committed. This behavior can be
130- altered, see :ref: `aqoptions `.
140+ The use of :meth: `~Connection.commit() ` allows messages to be sent only when
141+ any database transaction related to them is committed. This default behavior
142+ can be altered, see :ref: `aqoptions `.
131143
132- **Using JSON Payloads **
144+ **Enqueuing JSON Payloads **
133145
134146You can connect to the database and get the queue that was created with JSON
135147payload type by using:
@@ -162,9 +174,11 @@ Dequeuing Messages
162174==================
163175
164176Dequeuing is performed similarly. To dequeue a message call the method
165- :meth: `~Queue.deqone() ` as shown in the examples below.
177+ :meth: `~Queue.deqone() ` as shown in the examples below. This returns a
178+ :ref: `MessageProperties <msgproperties >` object containing the message payload
179+ and related attributes.
166180
167- **Using RAW Payloads **
181+ **Dequeuing RAW Payloads **
168182
169183.. code-block :: python
170184
@@ -174,9 +188,21 @@ Dequeuing is performed similarly. To dequeue a message call the method
174188 print (message.payload.decode())
175189
176190 Note that if the message is expected to be a string, the bytes must be decoded
177- by the application using ``message.payload.decode() ``, as shown.
191+ by the application using `decode()
192+ <https://docs.python.org/3/library/stdtypes.html#bytes.decode> `__, as shown.
193+
194+ If there are no messages in the queue, :meth: `~Queue.deqone() ` will wait for
195+ one to be enqueued. This default behavior can be altered, see
196+ :ref: `aqoptions `.
197+
198+ Various :ref: `message properties <msgproperties >` can be accessed. For example
199+ to show the :attr: `~MessageProperties.msgid ` of a dequeued message:
200+
201+ .. code-block :: python
202+
203+ print (message.msgid.hex())
178204
179- **Using JSON Payloads **
205+ **Dequeuing JSON Payloads **
180206
181207.. code-block :: python
182208
0 commit comments