1 | // Copyright (c) 2019, 2023, Oracle and/or its affiliates.
|
2 |
|
3 | //-----------------------------------------------------------------------------
|
4 | //
|
5 | // This software is dual-licensed to you under the Universal Permissive License
|
6 | // (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl and Apache License
|
7 | // 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose
|
8 | // either license.
|
9 | //
|
10 | // If you elect to accept the software under the Apache License, Version 2.0,
|
11 | // the following applies:
|
12 | //
|
13 | // Licensed under the Apache License, Version 2.0 (the "License");
|
14 | // you may not use this file except in compliance with the License.
|
15 | // You may obtain a copy of the License at
|
16 | //
|
17 | // https://www.apache.org/licenses/LICENSE-2.0
|
18 | //
|
19 | // Unless required by applicable law or agreed to in writing, software
|
20 | // distributed under the License is distributed on an "AS IS" BASIS,
|
21 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
22 | // See the License for the specific language governing permissions and
|
23 | // limitations under the License.
|
24 | //
|
25 | //-----------------------------------------------------------------------------
|
26 |
|
27 | ;
|
28 |
|
29 | const { Buffer } = require('buffer');
|
30 | const constants = require('./constants.js');
|
31 | const errors = require('./errors.js');
|
32 |
|
33 | class AqDeqOptions {
|
34 |
|
35 | //---------------------------------------------------------------------------
|
36 | // condition
|
37 | //
|
38 | // Property for the condition to use for dequeuing messages.
|
39 | //---------------------------------------------------------------------------
|
40 | get condition() {
|
41 | return this._impl.getCondition();
|
42 | }
|
43 |
|
44 | set condition(value) {
|
45 | errors.assertPropValue(typeof value === 'string', "condition");
|
46 | this._impl.setCondition(value);
|
47 | }
|
48 |
|
49 | //---------------------------------------------------------------------------
|
50 | // consumerName
|
51 | //
|
52 | // Property for the consumer name to use for dequeuing messages.
|
53 | //---------------------------------------------------------------------------
|
54 | get consumerName() {
|
55 | return this._impl.getConsumerName();
|
56 | }
|
57 |
|
58 | set consumerName(value) {
|
59 | errors.assertPropValue(typeof value === 'string', "consumerName");
|
60 | this._impl.setConsumerName(value);
|
61 | }
|
62 |
|
63 | //---------------------------------------------------------------------------
|
64 | // correlation
|
65 | //
|
66 | // Property for the correlation to use for dequeuing messages.
|
67 | //---------------------------------------------------------------------------
|
68 | get correlation() {
|
69 | return this._impl.getCorrelation();
|
70 | }
|
71 |
|
72 | set correlation(value) {
|
73 | errors.assertPropValue(typeof value === 'string', "correlation");
|
74 | this._impl.setCorrelation(value);
|
75 | }
|
76 |
|
77 | //---------------------------------------------------------------------------
|
78 | // mode
|
79 | //
|
80 | // Property for the mode to use for dequeuing messages.
|
81 | //---------------------------------------------------------------------------
|
82 | get mode() {
|
83 | return this._impl.getMode();
|
84 | }
|
85 |
|
86 | set mode(value) {
|
87 | errors.assertPropValue(value === constants.AQ_DEQ_MODE_BROWSE ||
|
88 | value === constants.AQ_DEQ_MODE_LOCKED ||
|
89 | value === constants.AQ_DEQ_MODE_REMOVE ||
|
90 | value === constants.AQ_DEQ_MODE_REMOVE_NO_DATA, "mode");
|
91 | this._impl.setMode(value);
|
92 | }
|
93 |
|
94 | //---------------------------------------------------------------------------
|
95 | // msgId
|
96 | //
|
97 | // Property for the message id to use for dequeuing messages.
|
98 | //---------------------------------------------------------------------------
|
99 | get msgId() {
|
100 | return this._impl.getMsgId();
|
101 | }
|
102 |
|
103 | set msgId(value) {
|
104 | errors.assertPropValue(Buffer.isBuffer(value), "msgId");
|
105 | this._impl.setMsgId(value);
|
106 | }
|
107 |
|
108 | //---------------------------------------------------------------------------
|
109 | // navigation
|
110 | //
|
111 | // Property for the navigation to use for dequeuing messages.
|
112 | //---------------------------------------------------------------------------
|
113 | get navigation() {
|
114 | return this._impl.getNavigation();
|
115 | }
|
116 |
|
117 | set navigation(value) {
|
118 | errors.assertPropValue(value === constants.AQ_DEQ_NAV_FIRST_MSG ||
|
119 | value === constants.AQ_DEQ_NAV_NEXT_TRANSACTION ||
|
120 | value === constants.AQ_DEQ_NAV_NEXT_MSG, "navigation");
|
121 | this._impl.setNavigation(value);
|
122 | }
|
123 |
|
124 | //---------------------------------------------------------------------------
|
125 | // transformation
|
126 | //
|
127 | // Property for the transformation to use for dequeuing messages.
|
128 | //---------------------------------------------------------------------------
|
129 | get transformation() {
|
130 | return this._impl.getTransformation();
|
131 | }
|
132 |
|
133 | set transformation(value) {
|
134 | errors.assertPropValue(typeof value === 'string', "transformation");
|
135 | this._impl.setTransformation(value);
|
136 | }
|
137 |
|
138 | //---------------------------------------------------------------------------
|
139 | // visibility
|
140 | //
|
141 | // Property for the visibility to use for dequeuing messages.
|
142 | //---------------------------------------------------------------------------
|
143 | get visibility() {
|
144 | return this._impl.getVisibility();
|
145 | }
|
146 |
|
147 | set visibility(value) {
|
148 | errors.assertPropValue(value === constants.AQ_VISIBILITY_IMMEDIATE ||
|
149 | value === constants.AQ_VISIBILITY_ON_COMMIT, "visibility");
|
150 | this._impl.setVisibility(value);
|
151 | }
|
152 |
|
153 | //---------------------------------------------------------------------------
|
154 | // wait
|
155 | //
|
156 | // Property for the time to wait for dequeuing messages.
|
157 | //---------------------------------------------------------------------------
|
158 | get wait() {
|
159 | return this._impl.getWait();
|
160 | }
|
161 |
|
162 | set wait(value) {
|
163 | errors.assertPropValue(Number.isInteger(value) && value >= 0, "wait");
|
164 | this._impl.setWait(value);
|
165 | }
|
166 |
|
167 | }
|
168 |
|
169 | module.exports = AqDeqOptions;
|