Skip to content

Commit 3ea0c64

Browse files
committed
Rename connection.queue() to connection.getQueue()
1 parent 5575648 commit 3ea0c64

File tree

10 files changed

+225
-955
lines changed

10 files changed

+225
-955
lines changed

doc/api.md

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ For installation information, see the [Node-oracledb Installation Instructions][
189189
- 4.2.10 [`getStatementInfo()`](#getstmtinfo)
190190
- 4.2.11 [`ping()`](#connectionping)
191191
- 4.2.12 [`queryStream()`](#querystream)
192-
- 4.2.13 [`queue()`](#queue)
192+
- 4.2.13 [`getQueue()`](#getqueue)
193193
- 4.2.14 [`release()`](#release)
194194
- 4.2.15 [`rollback()`](#rollback)
195195
- 4.2.16 [`subscribe()`](#consubscribe)
@@ -3582,18 +3582,18 @@ This method was added in node-oracledb 1.8.
35823582
35833583
See [execute()](#execute).
35843584
3585-
#### <a name="queue"></a> 4.2.13 `connection.queue()`
3585+
#### <a name="getQueue"></a> 4.2.13 `connection.getQueue()`
35863586
35873587
##### Prototype
35883588
35893589
Callback:
35903590
```
3591-
queue(String name, [Object options,] function(Error error, AqQueue queue){})
3591+
getQueue(String name, [Object options,] function(Error error, AqQueue queue){})
35923592
```
35933593
35943594
Promise:
35953595
```
3596-
promise = queue(String name [, Object options])
3596+
promise = getQueue(String name [, Object options])
35973597
```
35983598
35993599
##### Return Value
@@ -3957,7 +3957,7 @@ This method was added in node-oracledb 2.3.
39573957
39583958
## <a name="aqqueueclass"></a> 5. AqQueue Class
39593959
3960-
An AqQueue object is created by [`connection.queue()`](#queue). It
3960+
An AqQueue object is created by [`connection.getQueue()`](#getqueue). It
39613961
is used for enqueuing and dequeuing Oracle Advanced Queuing messages.
39623962
Each AqQueue can be used for enqueuing, dequeuing, or for both.
39633963
@@ -3974,7 +3974,7 @@ readonly String name
39743974
```
39753975
39763976
A string containing the name of the queue specified in the
3977-
[`connection.queue()`](#queue) call.
3977+
[`connection.getQueue()`](#getqueue) call.
39783978
39793979
#### <a name="aqqueuedeqopts"></a> 5.1.2 `aqQueue.deqOptions`
39803980
@@ -3988,7 +3988,7 @@ dequeuing messages. Attributes can be set before each
39883988
[`queue.deqMany()`](#aqqueuemethoddeqmany), see [Changing AQ
39893989
options](#aqoptions).
39903990
3991-
When a [queue is created](#queue), the `queue.deqOptions` property is
3991+
When a [queue is created](#getqueue), the `queue.deqOptions` property is
39923992
an [AqDeqOptions object](#aqdeqoptionsclass). AqDeqOptions objects
39933993
cannot be created independently.
39943994
@@ -4020,7 +4020,7 @@ enqueuing messages. Attributes can be set before each
40204020
[`queue.enqMany()`](#aqqueuemethodenqmany) call to change the behavior
40214021
of message delivery, see [Changing AQ options](#aqoptions).
40224022
4023-
When a [queue is created](#queue), the `queue.enqOptions` property is
4023+
When a [queue is created](#getqueue), the `queue.enqOptions` property is
40244024
an [AqEnqOptions object](#aqenqoptionsclass). AqEnqOptions objects
40254025
cannot be created independently.
40264026
@@ -12138,7 +12138,7 @@ To enqueue a single, simple message, you could run:
1213812138
1213912139
```javascript
1214012140
const queueName = "DEMO_RAW_QUEUE";
12141-
const queue = await connection.queue(queueName);
12141+
const queue = await connection.getQueue(queueName);
1214212142
await queue.enqOne("This is my message");
1214312143
await connection.commit();
1214412144
```
@@ -12147,7 +12147,7 @@ An application could dequeue a message by running:
1214712147
1214812148
```javascript
1214912149
const queueName = "DEMO_RAW_QUEUE";
12150-
const queue = await connection.queue(queueName);
12150+
const queue = await connection.getQueue(queueName);
1215112151
const msg = await queue.deqOne();
1215212152
await connection.commit();
1215312153
if (msg) {
@@ -12205,7 +12205,7 @@ In node-oracledb, a queue is initialized for the database object type:
1220512205
1220612206
```javascript
1220712207
const queueName = "ADDR_QUEUE";
12208-
const queue = await connection.queue(queueName, {payloadType: "DEMOQUEUE.USER_ADDRESS_TYPE"});
12208+
const queue = await connection.getQueue(queueName, {payloadType: "DEMOQUEUE.USER_ADDRESS_TYPE"});
1220912209
```
1221012210
1221112211
For efficiencey, it is recommended to use a fully qualified name for
@@ -12227,7 +12227,7 @@ await connection.commit();
1222712227
Dequeuing objects is done with:
1222812228
1222912229
```javascript
12230-
const queue = await connection.queue(queueName, {payloadType: "DEMOQUEUE.USER_ADDRESS_TYPE"});
12230+
const queue = await connection.getQueue(queueName, {payloadType: "DEMOQUEUE.USER_ADDRESS_TYPE"});
1223112231
const msg = await queue.deqOne();
1223212232
await connection.commit();
1223312233
```
@@ -12248,7 +12248,7 @@ See [`examples/aqobjects.js`][143] for a runnable example.
1224812248
### <a name="aqoptions"></a> 26.3 Changing AQ options
1224912249
1225012250
The [AqQueue](#aqqueueclass) object created by calling
12251-
[`connection.queue()`](#queue) contains
12251+
[`connection.getQueue()`](#getqueue) contains
1225212252
[`enqOptions`](#aqqueueenqopts) and [`deqOptions`](#aqqueuedeqopts)
1225312253
attribute options that can be configured. These options can be
1225412254
changed before each enqueue or dequeue call.
@@ -12269,7 +12269,7 @@ const message = {
1226912269
};
1227012270

1227112271
const queueName = "DEMO_RAW_QUEUE";
12272-
const queue = await connection.queue(queueName);
12272+
const queue = await connection.getQueue(queueName);
1227312273
await queue.enqOne(message);
1227412274
await connection.commit();
1227512275
```
@@ -12280,7 +12280,7 @@ message buffered, and not persistent:
1228012280
1228112281
```javascript
1228212282
const queueName = "DEMO_RAW_QUEUE";
12283-
const queue = await connection.queue(queueName);
12283+
const queue = await connection.getQueue(queueName);
1228412284
queue.enqOptions.deliveryMode = oracledb.AQ_MSG_DELIV_MODE_BUFFERED;
1228512285
await queue.enqOne(message);
1228612286
await connection.commit();
@@ -12291,7 +12291,7 @@ change the queue's message visibility:
1229112291
1229212292
```javascript
1229312293
const queueName = "DEMO_RAW_QUEUE";
12294-
const queue = await connection.queue(queueName);
12294+
const queue = await connection.getQueue(queueName);
1229512295
queue.enqOptions.visibility = oracledb.AQ_VISIBILITY_IMMEDIATE;
1229612296
await queue.enqOne(message);
1229712297
```
@@ -12304,7 +12304,7 @@ empty:
1230412304
1230512305
```javascript
1230612306
const queueName = "DEMO_RAW_QUEUE";
12307-
const queue = await connection.queue(queueName);
12307+
const queue = await connection.getQueue(queueName);
1230812308
queue.deqOptions.visibility = oracledb.AQ_VISIBILITY_IMMEDIATE;
1230912309
queue.deqOptions.wait = oracledb.AQ_DEQ_NO_WAIT;
1231012310
await msg = queue.deqOne();
@@ -12333,7 +12333,7 @@ of messages:
1233312333
1233412334
```javascript
1233512335
const queueName = "DEMO_RAW_QUEUE";
12336-
const queue = await connection.queue(queueName);
12336+
const queue = await connection.getQueue(queueName);
1233712337
const messages = [
1233812338
"Message 1",
1233912339
"Message 2",
@@ -12354,7 +12354,7 @@ should be dequeued in one call. Depending on the queue options, zero
1235412354
or more messages up to the limit will be dequeued:
1235512355
1235612356
```javascript
12357-
const queue = await connection.queue(queueName);
12357+
const queue = await connection.getQueue(queueName);
1235812358
const messages = await queue.deqMany(5);
1235912359
console.log("Dequeued " + messages.length + " messages");
1236012360
for (const msg of messages) {
@@ -12391,7 +12391,7 @@ const subscrOptions = {
1239112391

1239212392
async function ProcessAqMessages() {
1239312393
const connection = await oracledb.getConnection(); // get connection from a pool
12394-
const queue = await connection.queue(queueName);
12394+
const queue = await connection.getQueue(queueName);
1239512395
const msg = await queue.deqOne();
1239612396
console.log(msg.payload.toString()
1239712397
await connection.close();

examples/aqmulti.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ async function enq() {
4040

4141
try {
4242
connection = await oracledb.getConnection(dbConfig);
43-
const queue = await connection.queue(queueName);
43+
const queue = await connection.getQueue(queueName);
4444
queue.enqOptions.visibility = oracledb.AQ_VISIBILITY_IMMEDIATE; // Send a message without requiring a commit
4545

4646
console.log('Enqueuing messages');
@@ -74,7 +74,7 @@ async function deq() {
7474

7575
try {
7676
connection = await oracledb.getConnection(dbConfig);
77-
const queue = await connection.queue(queueName);
77+
const queue = await connection.getQueue(queueName);
7878
queue.deqOptions.visibility = oracledb.AQ_VISIBILITY_IMMEDIATE; // Change the visibility so no explicit commit is required
7979

8080
const messages = await queue.deqMany(5); // get at most 5 messages

examples/aqobject.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ async function enq() {
4848

4949
try {
5050
connection = await oracledb.getConnection(dbConfig);
51-
const queue = await connection.queue(queueName, {payloadType: "USER_ADDRESS_TYPE"});
51+
const queue = await connection.getQueue(queueName, {payloadType: "USER_ADDRESS_TYPE"});
5252
const message = new queue.payloadTypeClass(addrData);
5353
console.log('Enqueuing: ', addrData);
5454
await queue.enqOne(message);
@@ -71,7 +71,7 @@ async function deq() {
7171

7272
try {
7373
connection = await oracledb.getConnection(dbConfig);
74-
const queue = await connection.queue(queueName, {payloadType: "USER_ADDRESS_TYPE"});
74+
const queue = await connection.getQueue(queueName, {payloadType: "USER_ADDRESS_TYPE"});
7575
const msg = await queue.deqOne(); // wait for a message
7676
await connection.commit();
7777
if (msg) {

examples/aqoptions.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ async function enq() {
4141
try {
4242
connection = await oracledb.getConnection(dbConfig);
4343

44-
const queue = await connection.queue(queueName);
44+
const queue = await connection.getQueue(queueName);
4545
queue.enqOptions.visibility = oracledb.AQ_VISIBILITY_IMMEDIATE; // Send a message immediately without requiring a commit
4646

4747
const messageString = 'This is my other message';
@@ -70,7 +70,7 @@ async function deq() {
7070
try {
7171
connection = await oracledb.getConnection(dbConfig);
7272

73-
const queue = await connection.queue(queueName);
73+
const queue = await connection.getQueue(queueName);
7474
Object.assign(
7575
queue.deqOptions,
7676
{

examples/aqraw.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ async function enq() {
4040

4141
try {
4242
connection = await oracledb.getConnection(dbConfig);
43-
const queue = await connection.queue(queueName);
43+
const queue = await connection.getQueue(queueName);
4444
const messageString = 'This is my message';
4545
console.log('Enqueuing: ' + messageString);
4646
await queue.enqOne(messageString);
@@ -63,7 +63,7 @@ async function deq() {
6363

6464
try {
6565
connection = await oracledb.getConnection(dbConfig);
66-
const queue = await connection.queue(queueName);
66+
const queue = await connection.getQueue(queueName);
6767
const msg = await queue.deqOne(); // wait for a message
6868
await connection.commit();
6969
if (msg) {

lib/connection.js

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -316,18 +316,8 @@ function changePassword(user, password, newPassword, changePasswordCb) {
316316
self._changePassword.apply(self, arguments);
317317
}
318318

319-
// This ping function is just a place holder to allow for easier extension later.
320-
function ping(pingCb) {
321-
const self = this;
322-
323-
nodbUtil.assert(arguments.length === 1, 'NJS-009');
324-
nodbUtil.assert(typeof pingCb === 'function', 'NJS-005', 1);
325-
326-
self._ping.apply(self, arguments);
327-
}
328-
329319
// Returns an AQ queue
330-
function queue(name, a2, a3) {
320+
function getQueue(name, a2, a3) {
331321
let options = {};
332322
let queueCb;
333323
nodbUtil.assert(arguments.length >= 2 && arguments.length <= 3, 'NJS-009');
@@ -344,7 +334,17 @@ function queue(name, a2, a3) {
344334
queueCb = a3;
345335
break;
346336
}
347-
this._queue(name, options, queueCb);
337+
this._getQueue(name, options, queueCb);
338+
}
339+
340+
// This ping function is just a place holder to allow for easier extension later.
341+
function ping(pingCb) {
342+
const self = this;
343+
344+
nodbUtil.assert(arguments.length === 1, 'NJS-009');
345+
nodbUtil.assert(typeof pingCb === 'function', 'NJS-005', 1);
346+
347+
self._ping.apply(self, arguments);
348348
}
349349

350350
// create a subscription which can be used to get notifications of database
@@ -390,9 +390,9 @@ class Connection extends EventEmitter {
390390
this.execute = nodbUtil.promisify(oracledb, execute);
391391
this.executeMany = nodbUtil.promisify(oracledb, executeMany);
392392
this.getDbObjectClass = nodbUtil.promisify(oracledb, getDbObjectClass);
393+
this.getQueue = nodbUtil.promisify(oracledb, getQueue);
393394
this.getStatementInfo = nodbUtil.promisify(oracledb, getStatementInfo);
394395
this.ping = nodbUtil.promisify(oracledb, ping);
395-
this.queue = nodbUtil.promisify(oracledb, queue);
396396
this.release = nodbUtil.promisify(oracledb, close);
397397
this.rollback = nodbUtil.promisify(oracledb, rollback);
398398
this.subscribe = nodbUtil.promisify(oracledb, subscribe);

0 commit comments

Comments
 (0)