rocketmq-client-nodejs-bate 1.0.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (209) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +186 -0
  3. package/dist/client/BaseClient.d.ts +95 -0
  4. package/dist/client/BaseClient.js +324 -0
  5. package/dist/client/ClientId.d.ts +24 -0
  6. package/dist/client/ClientId.js +33 -0
  7. package/dist/client/Logger.d.ts +25 -0
  8. package/dist/client/Logger.js +33 -0
  9. package/dist/client/RpcClient.d.ts +48 -0
  10. package/dist/client/RpcClient.js +219 -0
  11. package/dist/client/RpcClientManager.d.ts +42 -0
  12. package/dist/client/RpcClientManager.js +144 -0
  13. package/dist/client/SessionCredentials.d.ts +21 -0
  14. package/dist/client/SessionCredentials.js +19 -0
  15. package/dist/client/Settings.d.ts +31 -0
  16. package/dist/client/Settings.js +40 -0
  17. package/dist/client/TelemetrySession.d.ts +27 -0
  18. package/dist/client/TelemetrySession.js +110 -0
  19. package/dist/client/UserAgent.d.ts +25 -0
  20. package/dist/client/UserAgent.js +47 -0
  21. package/dist/client/index.d.ts +26 -0
  22. package/dist/client/index.js +43 -0
  23. package/dist/consumer/Assignment.d.ts +23 -0
  24. package/dist/consumer/Assignment.js +40 -0
  25. package/dist/consumer/Assignments.d.ts +24 -0
  26. package/dist/consumer/Assignments.js +47 -0
  27. package/dist/consumer/ConsumeResult.d.ts +20 -0
  28. package/dist/consumer/ConsumeResult.js +25 -0
  29. package/dist/consumer/ConsumeService.d.ts +28 -0
  30. package/dist/consumer/ConsumeService.js +49 -0
  31. package/dist/consumer/ConsumeTask.d.ts +24 -0
  32. package/dist/consumer/ConsumeTask.js +40 -0
  33. package/dist/consumer/Consumer.d.ts +38 -0
  34. package/dist/consumer/Consumer.js +111 -0
  35. package/dist/consumer/FifoConsumeService.d.ts +25 -0
  36. package/dist/consumer/FifoConsumeService.js +123 -0
  37. package/dist/consumer/FilterExpression.d.ts +25 -0
  38. package/dist/consumer/FilterExpression.js +40 -0
  39. package/dist/consumer/MessageListener.d.ts +21 -0
  40. package/dist/consumer/MessageListener.js +19 -0
  41. package/dist/consumer/ProcessQueue.d.ts +39 -0
  42. package/dist/consumer/ProcessQueue.js +286 -0
  43. package/dist/consumer/PushConsumer.d.ts +68 -0
  44. package/dist/consumer/PushConsumer.js +377 -0
  45. package/dist/consumer/PushSubscriptionSettings.d.ts +31 -0
  46. package/dist/consumer/PushSubscriptionSettings.js +97 -0
  47. package/dist/consumer/SimpleConsumer.d.ts +50 -0
  48. package/dist/consumer/SimpleConsumer.js +122 -0
  49. package/dist/consumer/SimpleSubscriptionSettings.d.ts +28 -0
  50. package/dist/consumer/SimpleSubscriptionSettings.js +57 -0
  51. package/dist/consumer/StandardConsumeService.d.ts +24 -0
  52. package/dist/consumer/StandardConsumeService.js +42 -0
  53. package/dist/consumer/SubscriptionLoadBalancer.d.ts +23 -0
  54. package/dist/consumer/SubscriptionLoadBalancer.js +46 -0
  55. package/dist/consumer/index.d.ts +32 -0
  56. package/dist/consumer/index.js +49 -0
  57. package/dist/exception/BadRequestException.d.ts +20 -0
  58. package/dist/exception/BadRequestException.js +28 -0
  59. package/dist/exception/ClientException.d.ts +20 -0
  60. package/dist/exception/ClientException.js +31 -0
  61. package/dist/exception/ForbiddenException.d.ts +20 -0
  62. package/dist/exception/ForbiddenException.js +28 -0
  63. package/dist/exception/InternalErrorException.d.ts +20 -0
  64. package/dist/exception/InternalErrorException.js +28 -0
  65. package/dist/exception/NotFoundException.d.ts +20 -0
  66. package/dist/exception/NotFoundException.js +28 -0
  67. package/dist/exception/PayloadTooLargeException.d.ts +20 -0
  68. package/dist/exception/PayloadTooLargeException.js +28 -0
  69. package/dist/exception/PaymentRequiredException.d.ts +20 -0
  70. package/dist/exception/PaymentRequiredException.js +28 -0
  71. package/dist/exception/ProxyTimeoutException.d.ts +20 -0
  72. package/dist/exception/ProxyTimeoutException.js +28 -0
  73. package/dist/exception/RequestHeaderFieldsTooLargeException.d.ts +20 -0
  74. package/dist/exception/RequestHeaderFieldsTooLargeException.js +28 -0
  75. package/dist/exception/StatusChecker.d.ts +20 -0
  76. package/dist/exception/StatusChecker.js +98 -0
  77. package/dist/exception/TooManyRequestsException.d.ts +20 -0
  78. package/dist/exception/TooManyRequestsException.js +28 -0
  79. package/dist/exception/UnauthorizedException.d.ts +20 -0
  80. package/dist/exception/UnauthorizedException.js +28 -0
  81. package/dist/exception/UnsupportedException.d.ts +20 -0
  82. package/dist/exception/UnsupportedException.js +28 -0
  83. package/dist/exception/index.d.ts +29 -0
  84. package/dist/exception/index.js +46 -0
  85. package/dist/index.d.ts +22 -0
  86. package/dist/index.js +39 -0
  87. package/dist/message/Message.d.ts +38 -0
  88. package/dist/message/Message.js +57 -0
  89. package/dist/message/MessageId.d.ts +59 -0
  90. package/dist/message/MessageId.js +123 -0
  91. package/dist/message/MessageView.d.ts +38 -0
  92. package/dist/message/MessageView.js +90 -0
  93. package/dist/message/PublishingMessage.d.ts +30 -0
  94. package/dist/message/PublishingMessage.js +100 -0
  95. package/dist/message/index.d.ts +20 -0
  96. package/dist/message/index.js +37 -0
  97. package/dist/producer/Producer.d.ts +55 -0
  98. package/dist/producer/Producer.js +318 -0
  99. package/dist/producer/PublishingLoadBalancer.d.ts +24 -0
  100. package/dist/producer/PublishingLoadBalancer.js +82 -0
  101. package/dist/producer/PublishingSettings.d.ts +28 -0
  102. package/dist/producer/PublishingSettings.js +70 -0
  103. package/dist/producer/RecallReceipt.d.ts +25 -0
  104. package/dist/producer/RecallReceipt.js +34 -0
  105. package/dist/producer/SendReceipt.d.ts +29 -0
  106. package/dist/producer/SendReceipt.js +60 -0
  107. package/dist/producer/Transaction.d.ts +28 -0
  108. package/dist/producer/Transaction.js +70 -0
  109. package/dist/producer/TransactionChecker.d.ts +21 -0
  110. package/dist/producer/TransactionChecker.js +19 -0
  111. package/dist/producer/index.d.ts +22 -0
  112. package/dist/producer/index.js +40 -0
  113. package/dist/retry/ExponentialBackoffRetryPolicy.d.ts +27 -0
  114. package/dist/retry/ExponentialBackoffRetryPolicy.js +64 -0
  115. package/dist/retry/RetryPolicy.d.ts +46 -0
  116. package/dist/retry/RetryPolicy.js +19 -0
  117. package/dist/retry/index.d.ts +18 -0
  118. package/dist/retry/index.js +35 -0
  119. package/dist/route/Broker.d.ts +25 -0
  120. package/dist/route/Broker.js +40 -0
  121. package/dist/route/Endpoints.d.ts +30 -0
  122. package/dist/route/Endpoints.js +71 -0
  123. package/dist/route/MessageQueue.d.ts +27 -0
  124. package/dist/route/MessageQueue.js +47 -0
  125. package/dist/route/TopicRouteData.d.ts +24 -0
  126. package/dist/route/TopicRouteData.js +37 -0
  127. package/dist/route/index.d.ts +20 -0
  128. package/dist/route/index.js +37 -0
  129. package/dist/util/index.d.ts +35 -0
  130. package/dist/util/index.js +88 -0
  131. package/package.json +62 -0
  132. package/proto/apache/rocketmq/v2/admin.proto +43 -0
  133. package/proto/apache/rocketmq/v2/admin_grpc_pb.d.ts +41 -0
  134. package/proto/apache/rocketmq/v2/admin_grpc_pb.js +60 -0
  135. package/proto/apache/rocketmq/v2/admin_pb.d.ts +56 -0
  136. package/proto/apache/rocketmq/v2/admin_pb.js +340 -0
  137. package/proto/apache/rocketmq/v2/definition.proto +570 -0
  138. package/proto/apache/rocketmq/v2/definition_grpc_pb.js +1 -0
  139. package/proto/apache/rocketmq/v2/definition_pb.d.ts +885 -0
  140. package/proto/apache/rocketmq/v2/definition_pb.js +6141 -0
  141. package/proto/apache/rocketmq/v2/service.proto +443 -0
  142. package/proto/apache/rocketmq/v2/service_grpc_pb.d.ts +294 -0
  143. package/proto/apache/rocketmq/v2/service_grpc_pb.js +637 -0
  144. package/proto/apache/rocketmq/v2/service_pb.d.ts +1249 -0
  145. package/proto/apache/rocketmq/v2/service_pb.js +9723 -0
  146. package/src/client/BaseClient.ts +404 -0
  147. package/src/client/ClientId.ts +31 -0
  148. package/src/client/Logger.ts +36 -0
  149. package/src/client/RpcClient.ts +258 -0
  150. package/src/client/RpcClientManager.ts +180 -0
  151. package/src/client/SessionCredentials.ts +22 -0
  152. package/src/client/Settings.ts +46 -0
  153. package/src/client/TelemetrySession.ts +130 -0
  154. package/src/client/UserAgent.ts +45 -0
  155. package/src/client/index.ts +27 -0
  156. package/src/consumer/Assignment.ts +39 -0
  157. package/src/consumer/Assignments.ts +46 -0
  158. package/src/consumer/ConsumeResult.ts +21 -0
  159. package/src/consumer/ConsumeService.ts +54 -0
  160. package/src/consumer/ConsumeTask.ts +40 -0
  161. package/src/consumer/Consumer.ts +129 -0
  162. package/src/consumer/FifoConsumeService.ts +136 -0
  163. package/src/consumer/FilterExpression.ts +42 -0
  164. package/src/consumer/MessageListener.ts +23 -0
  165. package/src/consumer/ProcessQueue.ts +326 -0
  166. package/src/consumer/PushConsumer.ts +473 -0
  167. package/src/consumer/PushSubscriptionSettings.ts +123 -0
  168. package/src/consumer/SimpleConsumer.ts +153 -0
  169. package/src/consumer/SimpleSubscriptionSettings.ts +64 -0
  170. package/src/consumer/StandardConsumeService.ts +44 -0
  171. package/src/consumer/SubscriptionLoadBalancer.ts +47 -0
  172. package/src/consumer/index.ts +33 -0
  173. package/src/exception/BadRequestException.ts +25 -0
  174. package/src/exception/ClientException.ts +29 -0
  175. package/src/exception/ForbiddenException.ts +25 -0
  176. package/src/exception/InternalErrorException.ts +25 -0
  177. package/src/exception/NotFoundException.ts +25 -0
  178. package/src/exception/PayloadTooLargeException.ts +25 -0
  179. package/src/exception/PaymentRequiredException.ts +25 -0
  180. package/src/exception/ProxyTimeoutException.ts +25 -0
  181. package/src/exception/RequestHeaderFieldsTooLargeException.ts +25 -0
  182. package/src/exception/StatusChecker.ts +94 -0
  183. package/src/exception/TooManyRequestsException.ts +25 -0
  184. package/src/exception/UnauthorizedException.ts +25 -0
  185. package/src/exception/UnsupportedException.ts +25 -0
  186. package/src/exception/index.ts +30 -0
  187. package/src/index.ts +23 -0
  188. package/src/message/Message.ts +67 -0
  189. package/src/message/MessageId.ts +123 -0
  190. package/src/message/MessageView.ts +94 -0
  191. package/src/message/PublishingMessage.ts +104 -0
  192. package/src/message/index.ts +21 -0
  193. package/src/producer/Producer.ts +388 -0
  194. package/src/producer/PublishingLoadBalancer.ts +85 -0
  195. package/src/producer/PublishingSettings.ts +78 -0
  196. package/src/producer/RecallReceipt.ts +32 -0
  197. package/src/producer/SendReceipt.ts +63 -0
  198. package/src/producer/Transaction.ts +86 -0
  199. package/src/producer/TransactionChecker.ts +23 -0
  200. package/src/producer/index.ts +24 -0
  201. package/src/retry/ExponentialBackoffRetryPolicy.ts +76 -0
  202. package/src/retry/RetryPolicy.ts +51 -0
  203. package/src/retry/index.ts +19 -0
  204. package/src/route/Broker.ts +39 -0
  205. package/src/route/Endpoints.ts +70 -0
  206. package/src/route/MessageQueue.ts +49 -0
  207. package/src/route/TopicRouteData.ts +38 -0
  208. package/src/route/index.ts +21 -0
  209. package/src/util/index.ts +83 -0
@@ -0,0 +1,110 @@
1
+ "use strict";
2
+ /**
3
+ * Licensed to the Apache Software Foundation (ASF) under one or more
4
+ * contributor license agreements. See the NOTICE file distributed with
5
+ * this work for additional information regarding copyright ownership.
6
+ * The ASF licenses this file to You under the Apache License, Version 2.0
7
+ * (the "License"); you may not use this file except in compliance with
8
+ * the License. You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing, software
13
+ * distributed under the License is distributed on an "AS IS" BASIS,
14
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ * See the License for the specific language governing permissions and
16
+ * limitations under the License.
17
+ */
18
+ Object.defineProperty(exports, "__esModule", { value: true });
19
+ exports.TelemetrySession = void 0;
20
+ const service_pb_1 = require("../../proto/apache/rocketmq/v2/service_pb");
21
+ class TelemetrySession {
22
+ #endpoints;
23
+ #baseClient;
24
+ #logger;
25
+ #stream;
26
+ constructor(baseClient, endpoints, logger) {
27
+ this.#endpoints = endpoints;
28
+ this.#baseClient = baseClient;
29
+ this.#logger = logger;
30
+ this.#logger.info('Creating telemetry session, endpoints=%s, clientId=%s', endpoints, baseClient.clientId);
31
+ this.#renewStream(true);
32
+ }
33
+ release() {
34
+ this.#logger.info('Begin to release telemetry session, endpoints=%s, clientId=%s', this.#endpoints, this.#baseClient.clientId);
35
+ this.#stream.end();
36
+ this.#stream.removeAllListeners();
37
+ }
38
+ write(command) {
39
+ this.#stream.write(command);
40
+ }
41
+ syncSettings() {
42
+ const command = this.#baseClient.settingsCommand();
43
+ this.write(command);
44
+ }
45
+ #renewStream(inited) {
46
+ try {
47
+ this.#logger.debug?.('Creating telemetry stream, endpoints=%s, clientId=%s, inited=%s', this.#endpoints, this.#baseClient.clientId, inited);
48
+ this.#stream = this.#baseClient.createTelemetryStream(this.#endpoints);
49
+ this.#stream.on('data', this.#onData.bind(this));
50
+ this.#stream.once('error', this.#onError.bind(this));
51
+ this.#stream.once('end', this.#onEnd.bind(this));
52
+ if (!inited) {
53
+ this.#logger.info('Syncing settings to new stream, endpoints=%s, clientId=%s', this.#endpoints, this.#baseClient.clientId);
54
+ this.syncSettings();
55
+ }
56
+ }
57
+ catch (err) {
58
+ this.#logger.error('Failed to create telemetry stream, endpoints=%s, clientId=%s, error=%s', this.#endpoints, this.#baseClient.clientId, err);
59
+ throw err;
60
+ }
61
+ }
62
+ #onData(command) {
63
+ const endpoints = this.#endpoints;
64
+ const clientId = this.#baseClient.clientId;
65
+ const commandCase = command.getCommandCase();
66
+ switch (commandCase) {
67
+ case service_pb_1.TelemetryCommand.CommandCase.SETTINGS:
68
+ this.#logger.info('Receive settings from remote, endpoints=%s, clientId=%s', endpoints, clientId);
69
+ this.#baseClient.onSettingsCommand(endpoints, command.getSettings());
70
+ break;
71
+ case service_pb_1.TelemetryCommand.CommandCase.RECOVER_ORPHANED_TRANSACTION_COMMAND: {
72
+ this.#logger.info('Receive orphaned transaction recovery command from remote, endpoints=%s, clientId=%s', endpoints, clientId);
73
+ this.#baseClient.onRecoverOrphanedTransactionCommand(endpoints, command.getRecoverOrphanedTransactionCommand());
74
+ break;
75
+ }
76
+ case service_pb_1.TelemetryCommand.CommandCase.VERIFY_MESSAGE_COMMAND: {
77
+ this.#logger.info('Receive message verification command from remote, endpoints=%s, clientId=%s', endpoints, clientId);
78
+ this.#baseClient.onVerifyMessageCommand(endpoints, command.getVerifyMessageCommand());
79
+ break;
80
+ }
81
+ case service_pb_1.TelemetryCommand.CommandCase.PRINT_THREAD_STACK_TRACE_COMMAND: {
82
+ this.#logger.info('Receive thread stack print command from remote, endpoints=%s, clientId=%s', endpoints, clientId);
83
+ this.#baseClient.onPrintThreadStackTraceCommand(endpoints, command.getPrintThreadStackTraceCommand());
84
+ break;
85
+ }
86
+ default: {
87
+ const commandObj = command.toObject();
88
+ this.#logger.warn('Receive unrecognized command from remote, endpoints=%s, commandCase=%j, command=%j, clientId=%s', endpoints, commandCase, commandObj, clientId);
89
+ // should telemetry session start fail
90
+ this.#baseClient.onUnknownCommand(endpoints, commandObj.status);
91
+ }
92
+ }
93
+ }
94
+ #onError(err) {
95
+ this.#logger.error('Exception raised from stream response observer, endpoints=%s, clientId=%s, error=%s', this.#endpoints, this.#baseClient.clientId, err);
96
+ this.release();
97
+ setTimeout(() => {
98
+ this.#renewStream(false);
99
+ }, 1000);
100
+ }
101
+ #onEnd() {
102
+ this.#logger.info('Receive completion for stream response observer, endpoints=%s, clientId=%s', this.#endpoints, this.#baseClient.clientId);
103
+ this.release();
104
+ setTimeout(() => {
105
+ this.#renewStream(false);
106
+ }, 1000);
107
+ }
108
+ }
109
+ exports.TelemetrySession = TelemetrySession;
110
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiVGVsZW1ldHJ5U2Vzc2lvbi5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9jbGllbnQvVGVsZW1ldHJ5U2Vzc2lvbi50cyJdLCJuYW1lcy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ksQ0FBQyxPQUFPLENBQUMsS0FBSyxDQUFDLHFGQUFxRixFQUN0RyxJQUFJLENBQUMsVUFBVSxFQUFFLElBQUksQ0FBQyxXQUFXLENBQUMsUUFBUSxFQUFFLEdBQUcsQ0FBQyxDQUFDO1FBQ25ELElBQUksQ0FBQyxPQUFPLEVBQUUsQ0FBQztRQUNmLFVBQVUsQ0FBQyxHQUFHLEVBQUU7WUFDZCxJQUFJLENBQUMsWUFBWSxDQUFDLEtBQUssQ0FBQyxDQUFDO1FBQzNCLENBQUMsRUFBRSxJQUFJLENBQUMsQ0FBQztJQUNYLENBQUM7SUFFRCxNQUFNO1FBQ0osSUFBSSxDQUFDLE9BQU8sQ0FBQyxJQUFJLENBQUMsNEVBQTRFLEVBQzVGLElBQUksQ0FBQyxVQUFVLEVBQUUsSUFBSSxDQUFDLFdBQVcsQ0FBQyxRQUFRLENBQUMsQ0FBQztRQUM5QyxJQUFJLENBQUMsT0FBTyxFQUFFLENBQUM7UUFDZixVQUFVLENBQUMsR0FBRyxFQUFFO1lBQ2QsSUFBSSxDQUFDLFlBQVksQ0FBQyxLQUFLLENBQUMsQ0FBQztRQUMzQixDQUFDLEVBQUUsSUFBSSxDQUFDLENBQUM7SUFDWCxDQUFDO0NBQ0Y7QUExR0QsNENBMEdDIn0=
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Licensed to the Apache Software Foundation (ASF) under one or more
3
+ * contributor license agreements. See the NOTICE file distributed with
4
+ * this work for additional information regarding copyright ownership.
5
+ * The ASF licenses this file to You under the Apache License, Version 2.0
6
+ * (the "License"); you may not use this file except in compliance with
7
+ * the License. You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ import { UA } from '../../proto/apache/rocketmq/v2/definition_pb';
18
+ export declare class UserAgent {
19
+ static readonly INSTANCE: UserAgent;
20
+ readonly version: string;
21
+ readonly platform: string;
22
+ readonly hostname: string;
23
+ constructor(version: string, platform: string, hostname: string);
24
+ toProtobuf(): UA;
25
+ }
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+ /**
3
+ * Licensed to the Apache Software Foundation (ASF) under one or more
4
+ * contributor license agreements. See the NOTICE file distributed with
5
+ * this work for additional information regarding copyright ownership.
6
+ * The ASF licenses this file to You under the Apache License, Version 2.0
7
+ * (the "License"); you may not use this file except in compliance with
8
+ * the License. You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing, software
13
+ * distributed under the License is distributed on an "AS IS" BASIS,
14
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ * See the License for the specific language governing permissions and
16
+ * limitations under the License.
17
+ */
18
+ var __importDefault = (this && this.__importDefault) || function (mod) {
19
+ return (mod && mod.__esModule) ? mod : { "default": mod };
20
+ };
21
+ Object.defineProperty(exports, "__esModule", { value: true });
22
+ exports.UserAgent = void 0;
23
+ const node_os_1 = __importDefault(require("node:os"));
24
+ const node_path_1 = __importDefault(require("node:path"));
25
+ const node_fs_1 = require("node:fs");
26
+ const definition_pb_1 = require("../../proto/apache/rocketmq/v2/definition_pb");
27
+ const VERSION = JSON.parse((0, node_fs_1.readFileSync)(node_path_1.default.join(__dirname, '../../package.json'), 'utf-8')).version;
28
+ class UserAgent {
29
+ static INSTANCE = new UserAgent(VERSION, node_os_1.default.platform(), node_os_1.default.hostname());
30
+ version;
31
+ platform;
32
+ hostname;
33
+ constructor(version, platform, hostname) {
34
+ this.version = version;
35
+ this.platform = platform;
36
+ this.hostname = hostname;
37
+ }
38
+ toProtobuf() {
39
+ return new definition_pb_1.UA()
40
+ .setLanguage(definition_pb_1.Language.NODE_JS)
41
+ .setVersion(this.version)
42
+ .setPlatform(this.platform)
43
+ .setHostname(this.hostname);
44
+ }
45
+ }
46
+ exports.UserAgent = UserAgent;
47
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiVXNlckFnZW50LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL2NsaWVudC9Vc2VyQWdlbnQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBOzs7Ozs7Ozs7Ozs7Ozs7R0FlRzs7Ozs7O0FBRUgsc0RBQXlCO0FBQ3pCLDBEQUE2QjtBQUM3QixxQ0FBdUM7QUFDdkMsZ0ZBQTRFO0FBRTVFLE1BQU0sT0FBTyxHQUFXLElBQUksQ0FBQyxLQUFLLENBQUMsSUFBQSxzQkFBWSxFQUFDLG1CQUFJLENBQUMsSUFBSSxDQUFDLFNBQVMsRUFBRSxvQkFBb0IsQ0FBQyxFQUFFLE9BQU8sQ0FBQyxDQUFDLENBQUMsT0FBTyxDQUFDO0FBRTlHLE1BQWEsU0FBUztJQUNwQixNQUFNLENBQVUsUUFBUSxHQUFHLElBQUksU0FBUyxDQUFDLE9BQU8sRUFBRSxpQkFBRSxDQUFDLFFBQVEsRUFBRSxFQUFFLGlCQUFFLENBQUMsUUFBUSxFQUFFLENBQUMsQ0FBQztJQUV2RSxPQUFPLENBQVM7SUFDaEIsUUFBUSxDQUFTO0lBQ2pCLFFBQVEsQ0FBUztJQUUxQixZQUFZLE9BQWUsRUFBRSxRQUFnQixFQUFFLFFBQWdCO1FBQzdELElBQUksQ0FBQyxPQUFPLEdBQUcsT0FBTyxDQUFDO1FBQ3ZCLElBQUksQ0FBQyxRQUFRLEdBQUcsUUFBUSxDQUFDO1FBQ3pCLElBQUksQ0FBQyxRQUFRLEdBQUcsUUFBUSxDQUFDO0lBQzNCLENBQUM7SUFFRCxVQUFVO1FBQ1IsT0FBTyxJQUFJLGtCQUFFLEVBQUU7YUFDWixXQUFXLENBQUMsd0JBQVEsQ0FBQyxPQUFPLENBQUM7YUFDN0IsVUFBVSxDQUFDLElBQUksQ0FBQyxPQUFPLENBQUM7YUFDeEIsV0FBVyxDQUFDLElBQUksQ0FBQyxRQUFRLENBQUM7YUFDMUIsV0FBVyxDQUFDLElBQUksQ0FBQyxRQUFRLENBQUMsQ0FBQztJQUNoQyxDQUFDOztBQW5CSCw4QkFvQkMifQ==
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Licensed to the Apache Software Foundation (ASF) under one or more
3
+ * contributor license agreements. See the NOTICE file distributed with
4
+ * this work for additional information regarding copyright ownership.
5
+ * The ASF licenses this file to You under the Apache License, Version 2.0
6
+ * (the "License"); you may not use this file except in compliance with
7
+ * the License. You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ export * from './BaseClient';
18
+ export * from './ClientId';
19
+ export * from './Logger';
20
+ export * from './UserAgent';
21
+ export * from './RpcClient';
22
+ export * from './RpcClientManager';
23
+ export * from './SessionCredentials';
24
+ export * from './Settings';
25
+ export * from './TelemetrySession';
26
+ export * from './UserAgent';
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ /**
3
+ * Licensed to the Apache Software Foundation (ASF) under one or more
4
+ * contributor license agreements. See the NOTICE file distributed with
5
+ * this work for additional information regarding copyright ownership.
6
+ * The ASF licenses this file to You under the Apache License, Version 2.0
7
+ * (the "License"); you may not use this file except in compliance with
8
+ * the License. You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing, software
13
+ * distributed under the License is distributed on an "AS IS" BASIS,
14
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ * See the License for the specific language governing permissions and
16
+ * limitations under the License.
17
+ */
18
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
19
+ if (k2 === undefined) k2 = k;
20
+ var desc = Object.getOwnPropertyDescriptor(m, k);
21
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
22
+ desc = { enumerable: true, get: function() { return m[k]; } };
23
+ }
24
+ Object.defineProperty(o, k2, desc);
25
+ }) : (function(o, m, k, k2) {
26
+ if (k2 === undefined) k2 = k;
27
+ o[k2] = m[k];
28
+ }));
29
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
30
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
31
+ };
32
+ Object.defineProperty(exports, "__esModule", { value: true });
33
+ __exportStar(require("./BaseClient"), exports);
34
+ __exportStar(require("./ClientId"), exports);
35
+ __exportStar(require("./Logger"), exports);
36
+ __exportStar(require("./UserAgent"), exports);
37
+ __exportStar(require("./RpcClient"), exports);
38
+ __exportStar(require("./RpcClientManager"), exports);
39
+ __exportStar(require("./SessionCredentials"), exports);
40
+ __exportStar(require("./Settings"), exports);
41
+ __exportStar(require("./TelemetrySession"), exports);
42
+ __exportStar(require("./UserAgent"), exports);
43
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvY2xpZW50L2luZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQTs7Ozs7Ozs7Ozs7Ozs7O0dBZUc7Ozs7Ozs7Ozs7Ozs7Ozs7QUFFSCwrQ0FBNkI7QUFDN0IsNkNBQTJCO0FBQzNCLDJDQUF5QjtBQUN6Qiw4Q0FBNEI7QUFDNUIsOENBQTRCO0FBQzVCLHFEQUFtQztBQUNuQyx1REFBcUM7QUFDckMsNkNBQTJCO0FBQzNCLHFEQUFtQztBQUNuQyw4Q0FBNEIifQ==
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Licensed to the Apache Software Foundation (ASF) under one or more
3
+ * contributor license agreements. See the NOTICE file distributed with
4
+ * this work for additional information regarding copyright ownership.
5
+ * The ASF licenses this file to You under the Apache License, Version 2.0
6
+ * (the "License"); you may not use this file except in compliance with
7
+ * the License. You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ import { MessageQueue } from '../route';
18
+ export declare class Assignment {
19
+ readonly messageQueue: MessageQueue;
20
+ constructor(messageQueue: MessageQueue);
21
+ equals(other: Assignment): boolean;
22
+ toString(): string;
23
+ }
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ /**
3
+ * Licensed to the Apache Software Foundation (ASF) under one or more
4
+ * contributor license agreements. See the NOTICE file distributed with
5
+ * this work for additional information regarding copyright ownership.
6
+ * The ASF licenses this file to You under the Apache License, Version 2.0
7
+ * (the "License"); you may not use this file except in compliance with
8
+ * the License. You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing, software
13
+ * distributed under the License is distributed on an "AS IS" BASIS,
14
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ * See the License for the specific language governing permissions and
16
+ * limitations under the License.
17
+ */
18
+ Object.defineProperty(exports, "__esModule", { value: true });
19
+ exports.Assignment = void 0;
20
+ class Assignment {
21
+ messageQueue;
22
+ constructor(messageQueue) {
23
+ this.messageQueue = messageQueue;
24
+ }
25
+ equals(other) {
26
+ if (this === other)
27
+ return true;
28
+ if (!other)
29
+ return false;
30
+ return this.messageQueue === other.messageQueue ||
31
+ (this.messageQueue.queueId === other.messageQueue.queueId &&
32
+ this.messageQueue.topic.name === other.messageQueue.topic.name &&
33
+ this.messageQueue.broker.name === other.messageQueue.broker.name);
34
+ }
35
+ toString() {
36
+ return `Assignment{messageQueue=${JSON.stringify(this.messageQueue)}}`;
37
+ }
38
+ }
39
+ exports.Assignment = Assignment;
40
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiQXNzaWdubWVudC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9jb25zdW1lci9Bc3NpZ25tZW50LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQTs7Ozs7Ozs7Ozs7Ozs7O0dBZUc7OztBQUlILE1BQWEsVUFBVTtJQUNaLFlBQVksQ0FBZTtJQUVwQyxZQUFZLFlBQTBCO1FBQ3BDLElBQUksQ0FBQyxZQUFZLEdBQUcsWUFBWSxDQUFDO0lBQ25DLENBQUM7SUFFRCxNQUFNLENBQUMsS0FBaUI7UUFDdEIsSUFBSSxJQUFJLEtBQUssS0FBSztZQUFFLE9BQU8sSUFBSSxDQUFDO1FBQ2hDLElBQUksQ0FBQyxLQUFLO1lBQUUsT0FBTyxLQUFLLENBQUM7UUFDekIsT0FBTyxJQUFJLENBQUMsWUFBWSxLQUFLLEtBQUssQ0FBQyxZQUFZO1lBQzdDLENBQUMsSUFBSSxDQUFDLFlBQVksQ0FBQyxPQUFPLEtBQUssS0FBSyxDQUFDLFlBQVksQ0FBQyxPQUFPO2dCQUN4RCxJQUFJLENBQUMsWUFBWSxDQUFDLEtBQUssQ0FBQyxJQUFJLEtBQUssS0FBSyxDQUFDLFlBQVksQ0FBQyxLQUFLLENBQUMsSUFBSTtnQkFDOUQsSUFBSSxDQUFDLFlBQVksQ0FBQyxNQUFNLENBQUMsSUFBSSxLQUFLLEtBQUssQ0FBQyxZQUFZLENBQUMsTUFBTSxDQUFDLElBQUksQ0FBQyxDQUFDO0lBQ3ZFLENBQUM7SUFFRCxRQUFRO1FBQ04sT0FBTywyQkFBMkIsSUFBSSxDQUFDLFNBQVMsQ0FBQyxJQUFJLENBQUMsWUFBWSxDQUFDLEdBQUcsQ0FBQztJQUN6RSxDQUFDO0NBQ0Y7QUFuQkQsZ0NBbUJDIn0=
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Licensed to the Apache Software Foundation (ASF) under one or more
3
+ * contributor license agreements. See the NOTICE file distributed with
4
+ * this work for additional information regarding copyright ownership.
5
+ * The ASF licenses this file to You under the Apache License, Version 2.0
6
+ * (the "License"); you may not use this file except in compliance with
7
+ * the License. You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ import { Assignment } from './Assignment';
18
+ export declare class Assignments {
19
+ #private;
20
+ constructor(assignmentList: Assignment[]);
21
+ getAssignmentList(): Assignment[];
22
+ equals(other?: Assignments): boolean;
23
+ toString(): string;
24
+ }
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+ /**
3
+ * Licensed to the Apache Software Foundation (ASF) under one or more
4
+ * contributor license agreements. See the NOTICE file distributed with
5
+ * this work for additional information regarding copyright ownership.
6
+ * The ASF licenses this file to You under the Apache License, Version 2.0
7
+ * (the "License"); you may not use this file except in compliance with
8
+ * the License. You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing, software
13
+ * distributed under the License is distributed on an "AS IS" BASIS,
14
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ * See the License for the specific language governing permissions and
16
+ * limitations under the License.
17
+ */
18
+ Object.defineProperty(exports, "__esModule", { value: true });
19
+ exports.Assignments = void 0;
20
+ class Assignments {
21
+ #assignmentList;
22
+ constructor(assignmentList) {
23
+ this.#assignmentList = assignmentList;
24
+ }
25
+ getAssignmentList() {
26
+ return this.#assignmentList;
27
+ }
28
+ equals(other) {
29
+ if (this === other)
30
+ return true;
31
+ if (!other)
32
+ return false;
33
+ if (this.#assignmentList.length !== other.#assignmentList.length)
34
+ return false;
35
+ for (let i = 0; i < this.#assignmentList.length; i++) {
36
+ if (!this.#assignmentList[i].equals(other.#assignmentList[i])) {
37
+ return false;
38
+ }
39
+ }
40
+ return true;
41
+ }
42
+ toString() {
43
+ return `Assignments{assignmentList=[${this.#assignmentList.map(a => a.toString()).join(', ')}]}`;
44
+ }
45
+ }
46
+ exports.Assignments = Assignments;
47
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiQXNzaWdubWVudHMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvY29uc3VtZXIvQXNzaWdubWVudHMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBOzs7Ozs7Ozs7Ozs7Ozs7R0FlRzs7O0FBSUgsTUFBYSxXQUFXO0lBQ2IsZUFBZSxDQUFlO0lBRXZDLFlBQVksY0FBNEI7UUFDdEMsSUFBSSxDQUFDLGVBQWUsR0FBRyxjQUFjLENBQUM7SUFDeEMsQ0FBQztJQUVELGlCQUFpQjtRQUNmLE9BQU8sSUFBSSxDQUFDLGVBQWUsQ0FBQztJQUM5QixDQUFDO0lBRUQsTUFBTSxDQUFDLEtBQW1CO1FBQ3hCLElBQUksSUFBSSxLQUFLLEtBQUs7WUFBRSxPQUFPLElBQUksQ0FBQztRQUNoQyxJQUFJLENBQUMsS0FBSztZQUFFLE9BQU8sS0FBSyxDQUFDO1FBQ3pCLElBQUksSUFBSSxDQUFDLGVBQWUsQ0FBQyxNQUFNLEtBQUssS0FBSyxDQUFDLGVBQWUsQ0FBQyxNQUFNO1lBQUUsT0FBTyxLQUFLLENBQUM7UUFDL0UsS0FBSyxJQUFJLENBQUMsR0FBRyxDQUFDLEVBQUUsQ0FBQyxHQUFHLElBQUksQ0FBQyxlQUFlLENBQUMsTUFBTSxFQUFFLENBQUMsRUFBRSxFQUFFLENBQUM7WUFDckQsSUFBSSxDQUFDLElBQUksQ0FBQyxlQUFlLENBQUMsQ0FBQyxDQUFDLENBQUMsTUFBTSxDQUFDLEtBQUssQ0FBQyxlQUFlLENBQUMsQ0FBQyxDQUFDLENBQUMsRUFBRSxDQUFDO2dCQUM5RCxPQUFPLEtBQUssQ0FBQztZQUNmLENBQUM7UUFDSCxDQUFDO1FBQ0QsT0FBTyxJQUFJLENBQUM7SUFDZCxDQUFDO0lBRUQsUUFBUTtRQUNOLE9BQU8sK0JBQStCLElBQUksQ0FBQyxlQUFlLENBQUMsR0FBRyxDQUFDLENBQUMsQ0FBQyxFQUFFLENBQUMsQ0FBQyxDQUFDLFFBQVEsRUFBRSxDQUFDLENBQUMsSUFBSSxDQUFDLElBQUksQ0FBQyxJQUFJLENBQUM7SUFDbkcsQ0FBQztDQUNGO0FBMUJELGtDQTBCQyJ9
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Licensed to the Apache Software Foundation (ASF) under one or more
3
+ * contributor license agreements. See the NOTICE file distributed with
4
+ * this work for additional information regarding copyright ownership.
5
+ * The ASF licenses this file to You under the Apache License, Version 2.0
6
+ * (the "License"); you may not use this file except in compliance with
7
+ * the License. You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ export declare enum ConsumeResult {
18
+ SUCCESS = "SUCCESS",
19
+ FAILURE = "FAILURE"
20
+ }
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ /**
3
+ * Licensed to the Apache Software Foundation (ASF) under one or more
4
+ * contributor license agreements. See the NOTICE file distributed with
5
+ * this work for additional information regarding copyright ownership.
6
+ * The ASF licenses this file to You under the Apache License, Version 2.0
7
+ * (the "License"); you may not use this file except in compliance with
8
+ * the License. You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing, software
13
+ * distributed under the License is distributed on an "AS IS" BASIS,
14
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ * See the License for the specific language governing permissions and
16
+ * limitations under the License.
17
+ */
18
+ Object.defineProperty(exports, "__esModule", { value: true });
19
+ exports.ConsumeResult = void 0;
20
+ var ConsumeResult;
21
+ (function (ConsumeResult) {
22
+ ConsumeResult["SUCCESS"] = "SUCCESS";
23
+ ConsumeResult["FAILURE"] = "FAILURE";
24
+ })(ConsumeResult || (exports.ConsumeResult = ConsumeResult = {}));
25
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiQ29uc3VtZVJlc3VsdC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9jb25zdW1lci9Db25zdW1lUmVzdWx0LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQTs7Ozs7Ozs7Ozs7Ozs7O0dBZUc7OztBQUVILElBQVksYUFHWDtBQUhELFdBQVksYUFBYTtJQUN2QixvQ0FBbUIsQ0FBQTtJQUNuQixvQ0FBbUIsQ0FBQTtBQUNyQixDQUFDLEVBSFcsYUFBYSw2QkFBYixhQUFhLFFBR3hCIn0=
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Licensed to the Apache Software Foundation (ASF) under one or more
3
+ * contributor license agreements. See the NOTICE file distributed with
4
+ * this work for additional information regarding copyright ownership.
5
+ * The ASF licenses this file to You under the Apache License, Version 2.0
6
+ * (the "License"); you may not use this file except in compliance with
7
+ * the License. You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ import { MessageView } from '../message';
18
+ import { ConsumeResult } from './ConsumeResult';
19
+ import { MessageListener } from './MessageListener';
20
+ import type { ProcessQueue } from './ProcessQueue';
21
+ export declare abstract class ConsumeService {
22
+ #private;
23
+ protected readonly clientId: string;
24
+ constructor(clientId: string, messageListener: MessageListener);
25
+ abstract consume(pq: ProcessQueue, messageViews: MessageView[]): void;
26
+ consumeMessage(messageView: MessageView, delay?: number): Promise<ConsumeResult>;
27
+ abort(): void;
28
+ }
@@ -0,0 +1,49 @@
1
+ "use strict";
2
+ /**
3
+ * Licensed to the Apache Software Foundation (ASF) under one or more
4
+ * contributor license agreements. See the NOTICE file distributed with
5
+ * this work for additional information regarding copyright ownership.
6
+ * The ASF licenses this file to You under the Apache License, Version 2.0
7
+ * (the "License"); you may not use this file except in compliance with
8
+ * the License. You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing, software
13
+ * distributed under the License is distributed on an "AS IS" BASIS,
14
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ * See the License for the specific language governing permissions and
16
+ * limitations under the License.
17
+ */
18
+ Object.defineProperty(exports, "__esModule", { value: true });
19
+ exports.ConsumeService = void 0;
20
+ const ConsumeResult_1 = require("./ConsumeResult");
21
+ const ConsumeTask_1 = require("./ConsumeTask");
22
+ class ConsumeService {
23
+ clientId;
24
+ #messageListener;
25
+ #aborted = false;
26
+ constructor(clientId, messageListener) {
27
+ this.clientId = clientId;
28
+ this.#messageListener = messageListener;
29
+ }
30
+ async consumeMessage(messageView, delay = 0) {
31
+ if (this.#aborted) {
32
+ return ConsumeResult_1.ConsumeResult.FAILURE;
33
+ }
34
+ const task = new ConsumeTask_1.ConsumeTask(this.clientId, this.#messageListener, messageView);
35
+ if (delay <= 0) {
36
+ return task.call();
37
+ }
38
+ await new Promise(resolve => setTimeout(resolve, delay));
39
+ if (this.#aborted) {
40
+ return ConsumeResult_1.ConsumeResult.FAILURE;
41
+ }
42
+ return task.call();
43
+ }
44
+ abort() {
45
+ this.#aborted = true;
46
+ }
47
+ }
48
+ exports.ConsumeService = ConsumeService;
49
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiQ29uc3VtZVNlcnZpY2UuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvY29uc3VtZXIvQ29uc3VtZVNlcnZpY2UudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBOzs7Ozs7Ozs7Ozs7Ozs7R0FlRzs7O0FBR0gsbURBQWdEO0FBQ2hELCtDQUE0QztBQUk1QyxNQUFzQixjQUFjO0lBQ2YsUUFBUSxDQUFTO0lBQzNCLGdCQUFnQixDQUFrQjtJQUMzQyxRQUFRLEdBQUcsS0FBSyxDQUFDO0lBRWpCLFlBQVksUUFBZ0IsRUFBRSxlQUFnQztRQUM1RCxJQUFJLENBQUMsUUFBUSxHQUFHLFFBQVEsQ0FBQztRQUN6QixJQUFJLENBQUMsZ0JBQWdCLEdBQUcsZUFBZSxDQUFDO0lBQzFDLENBQUM7SUFJRCxLQUFLLENBQUMsY0FBYyxDQUFDLFdBQXdCLEVBQUUsS0FBSyxHQUFHLENBQUM7UUFDdEQsSUFBSSxJQUFJLENBQUMsUUFBUSxFQUFFLENBQUM7WUFDbEIsT0FBTyw2QkFBYSxDQUFDLE9BQU8sQ0FBQztRQUMvQixDQUFDO1FBQ0QsTUFBTSxJQUFJLEdBQUcsSUFBSSx5QkFBVyxDQUFDLElBQUksQ0FBQyxRQUFRLEVBQUUsSUFBSSxDQUFDLGdCQUFnQixFQUFFLFdBQVcsQ0FBQyxDQUFDO1FBQ2hGLElBQUksS0FBSyxJQUFJLENBQUMsRUFBRSxDQUFDO1lBQ2YsT0FBTyxJQUFJLENBQUMsSUFBSSxFQUFFLENBQUM7UUFDckIsQ0FBQztRQUNELE1BQU0sSUFBSSxPQUFPLENBQU8sT0FBTyxDQUFDLEVBQUUsQ0FBQyxVQUFVLENBQUMsT0FBTyxFQUFFLEtBQUssQ0FBQyxDQUFDLENBQUM7UUFDL0QsSUFBSSxJQUFJLENBQUMsUUFBUSxFQUFFLENBQUM7WUFDbEIsT0FBTyw2QkFBYSxDQUFDLE9BQU8sQ0FBQztRQUMvQixDQUFDO1FBQ0QsT0FBTyxJQUFJLENBQUMsSUFBSSxFQUFFLENBQUM7SUFDckIsQ0FBQztJQUVELEtBQUs7UUFDSCxJQUFJLENBQUMsUUFBUSxHQUFHLElBQUksQ0FBQztJQUN2QixDQUFDO0NBQ0Y7QUE5QkQsd0NBOEJDIn0=
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Licensed to the Apache Software Foundation (ASF) under one or more
3
+ * contributor license agreements. See the NOTICE file distributed with
4
+ * this work for additional information regarding copyright ownership.
5
+ * The ASF licenses this file to You under the Apache License, Version 2.0
6
+ * (the "License"); you may not use this file except in compliance with
7
+ * the License. You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ import { MessageView } from '../message';
18
+ import { ConsumeResult } from './ConsumeResult';
19
+ import { MessageListener } from './MessageListener';
20
+ export declare class ConsumeTask {
21
+ #private;
22
+ constructor(_clientId: string, messageListener: MessageListener, messageView: MessageView);
23
+ call(): Promise<ConsumeResult>;
24
+ }
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ /**
3
+ * Licensed to the Apache Software Foundation (ASF) under one or more
4
+ * contributor license agreements. See the NOTICE file distributed with
5
+ * this work for additional information regarding copyright ownership.
6
+ * The ASF licenses this file to You under the Apache License, Version 2.0
7
+ * (the "License"); you may not use this file except in compliance with
8
+ * the License. You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing, software
13
+ * distributed under the License is distributed on an "AS IS" BASIS,
14
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ * See the License for the specific language governing permissions and
16
+ * limitations under the License.
17
+ */
18
+ Object.defineProperty(exports, "__esModule", { value: true });
19
+ exports.ConsumeTask = void 0;
20
+ const ConsumeResult_1 = require("./ConsumeResult");
21
+ class ConsumeTask {
22
+ #messageListener;
23
+ #messageView;
24
+ constructor(_clientId, messageListener, messageView) {
25
+ this.#messageListener = messageListener;
26
+ this.#messageView = messageView;
27
+ }
28
+ async call() {
29
+ try {
30
+ const result = await this.#messageListener.consume(this.#messageView);
31
+ return result;
32
+ }
33
+ catch (e) {
34
+ // Message listener raised an exception while consuming messages
35
+ return ConsumeResult_1.ConsumeResult.FAILURE;
36
+ }
37
+ }
38
+ }
39
+ exports.ConsumeTask = ConsumeTask;
40
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiQ29uc3VtZVRhc2suanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvY29uc3VtZXIvQ29uc3VtZVRhc2sudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBOzs7Ozs7Ozs7Ozs7Ozs7R0FlRzs7O0FBR0gsbURBQWdEO0FBR2hELE1BQWEsV0FBVztJQUNiLGdCQUFnQixDQUFrQjtJQUNsQyxZQUFZLENBQWM7SUFFbkMsWUFBWSxTQUFpQixFQUFFLGVBQWdDLEVBQUUsV0FBd0I7UUFDdkYsSUFBSSxDQUFDLGdCQUFnQixHQUFHLGVBQWUsQ0FBQztRQUN4QyxJQUFJLENBQUMsWUFBWSxHQUFHLFdBQVcsQ0FBQztJQUNsQyxDQUFDO0lBRUQsS0FBSyxDQUFDLElBQUk7UUFDUixJQUFJLENBQUM7WUFDSCxNQUFNLE1BQU0sR0FBRyxNQUFNLElBQUksQ0FBQyxnQkFBZ0IsQ0FBQyxPQUFPLENBQUMsSUFBSSxDQUFDLFlBQVksQ0FBQyxDQUFDO1lBQ3RFLE9BQU8sTUFBTSxDQUFDO1FBQ2hCLENBQUM7UUFBQyxPQUFPLENBQUMsRUFBRSxDQUFDO1lBQ1gsZ0VBQWdFO1lBQ2hFLE9BQU8sNkJBQWEsQ0FBQyxPQUFPLENBQUM7UUFDL0IsQ0FBQztJQUNILENBQUM7Q0FDRjtBQWxCRCxrQ0FrQkMifQ==
@@ -0,0 +1,38 @@
1
+ /**
2
+ * Licensed to the Apache Software Foundation (ASF) under one or more
3
+ * contributor license agreements. See the NOTICE file distributed with
4
+ * this work for additional information regarding copyright ownership.
5
+ * The ASF licenses this file to You under the Apache License, Version 2.0
6
+ * (the "License"); you may not use this file except in compliance with
7
+ * the License. You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ import { AckMessageRequest, ChangeInvisibleDurationRequest, ReceiveMessageRequest } from '../../proto/apache/rocketmq/v2/service_pb';
18
+ import { MessageView } from '../message';
19
+ import { MessageQueue } from '../route';
20
+ import { BaseClient, BaseClientOptions } from '../client';
21
+ import { FilterExpression } from './FilterExpression';
22
+ export interface ConsumerOptions extends BaseClientOptions {
23
+ consumerGroup: string;
24
+ }
25
+ export declare abstract class Consumer extends BaseClient {
26
+ protected readonly consumerGroup: string;
27
+ constructor(options: ConsumerOptions);
28
+ protected wrapReceiveMessageRequest(batchSize: number, mq: MessageQueue, filterExpression: FilterExpression, invisibleDuration: number, longPollingTimeout: number): ReceiveMessageRequest;
29
+ protected receiveMessage(request: ReceiveMessageRequest, mq: MessageQueue, awaitDuration: number): Promise<MessageView[]>;
30
+ protected ackMessage(messageView: MessageView): Promise<import("../../proto/apache/rocketmq/v2/service_pb").AckMessageResultEntry.AsObject[]>;
31
+ protected invisibleDuration(messageView: MessageView, invisibleDuration: number): Promise<string>;
32
+ /**
33
+ * Expose public methods for ProcessQueue to access RPC operations
34
+ */
35
+ ackMessageViaRpc(endpoints: any, request: AckMessageRequest, timeout: number): Promise<import("../../proto/apache/rocketmq/v2/service_pb").AckMessageResponse>;
36
+ changeInvisibleDurationViaRpc(endpoints: any, request: ChangeInvisibleDurationRequest, timeout: number): Promise<import("../../proto/apache/rocketmq/v2/service_pb").ChangeInvisibleDurationResponse>;
37
+ forwardMessageToDeadLetterQueueViaRpc(endpoints: any, request: any, timeout: number): Promise<import("../../proto/apache/rocketmq/v2/service_pb").ForwardMessageToDeadLetterQueueResponse>;
38
+ }