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.
- package/LICENSE +201 -0
- package/README.md +186 -0
- package/dist/client/BaseClient.d.ts +95 -0
- package/dist/client/BaseClient.js +324 -0
- package/dist/client/ClientId.d.ts +24 -0
- package/dist/client/ClientId.js +33 -0
- package/dist/client/Logger.d.ts +25 -0
- package/dist/client/Logger.js +33 -0
- package/dist/client/RpcClient.d.ts +48 -0
- package/dist/client/RpcClient.js +219 -0
- package/dist/client/RpcClientManager.d.ts +42 -0
- package/dist/client/RpcClientManager.js +144 -0
- package/dist/client/SessionCredentials.d.ts +21 -0
- package/dist/client/SessionCredentials.js +19 -0
- package/dist/client/Settings.d.ts +31 -0
- package/dist/client/Settings.js +40 -0
- package/dist/client/TelemetrySession.d.ts +27 -0
- package/dist/client/TelemetrySession.js +110 -0
- package/dist/client/UserAgent.d.ts +25 -0
- package/dist/client/UserAgent.js +47 -0
- package/dist/client/index.d.ts +26 -0
- package/dist/client/index.js +43 -0
- package/dist/consumer/Assignment.d.ts +23 -0
- package/dist/consumer/Assignment.js +40 -0
- package/dist/consumer/Assignments.d.ts +24 -0
- package/dist/consumer/Assignments.js +47 -0
- package/dist/consumer/ConsumeResult.d.ts +20 -0
- package/dist/consumer/ConsumeResult.js +25 -0
- package/dist/consumer/ConsumeService.d.ts +28 -0
- package/dist/consumer/ConsumeService.js +49 -0
- package/dist/consumer/ConsumeTask.d.ts +24 -0
- package/dist/consumer/ConsumeTask.js +40 -0
- package/dist/consumer/Consumer.d.ts +38 -0
- package/dist/consumer/Consumer.js +111 -0
- package/dist/consumer/FifoConsumeService.d.ts +25 -0
- package/dist/consumer/FifoConsumeService.js +123 -0
- package/dist/consumer/FilterExpression.d.ts +25 -0
- package/dist/consumer/FilterExpression.js +40 -0
- package/dist/consumer/MessageListener.d.ts +21 -0
- package/dist/consumer/MessageListener.js +19 -0
- package/dist/consumer/ProcessQueue.d.ts +39 -0
- package/dist/consumer/ProcessQueue.js +286 -0
- package/dist/consumer/PushConsumer.d.ts +68 -0
- package/dist/consumer/PushConsumer.js +377 -0
- package/dist/consumer/PushSubscriptionSettings.d.ts +31 -0
- package/dist/consumer/PushSubscriptionSettings.js +97 -0
- package/dist/consumer/SimpleConsumer.d.ts +50 -0
- package/dist/consumer/SimpleConsumer.js +122 -0
- package/dist/consumer/SimpleSubscriptionSettings.d.ts +28 -0
- package/dist/consumer/SimpleSubscriptionSettings.js +57 -0
- package/dist/consumer/StandardConsumeService.d.ts +24 -0
- package/dist/consumer/StandardConsumeService.js +42 -0
- package/dist/consumer/SubscriptionLoadBalancer.d.ts +23 -0
- package/dist/consumer/SubscriptionLoadBalancer.js +46 -0
- package/dist/consumer/index.d.ts +32 -0
- package/dist/consumer/index.js +49 -0
- package/dist/exception/BadRequestException.d.ts +20 -0
- package/dist/exception/BadRequestException.js +28 -0
- package/dist/exception/ClientException.d.ts +20 -0
- package/dist/exception/ClientException.js +31 -0
- package/dist/exception/ForbiddenException.d.ts +20 -0
- package/dist/exception/ForbiddenException.js +28 -0
- package/dist/exception/InternalErrorException.d.ts +20 -0
- package/dist/exception/InternalErrorException.js +28 -0
- package/dist/exception/NotFoundException.d.ts +20 -0
- package/dist/exception/NotFoundException.js +28 -0
- package/dist/exception/PayloadTooLargeException.d.ts +20 -0
- package/dist/exception/PayloadTooLargeException.js +28 -0
- package/dist/exception/PaymentRequiredException.d.ts +20 -0
- package/dist/exception/PaymentRequiredException.js +28 -0
- package/dist/exception/ProxyTimeoutException.d.ts +20 -0
- package/dist/exception/ProxyTimeoutException.js +28 -0
- package/dist/exception/RequestHeaderFieldsTooLargeException.d.ts +20 -0
- package/dist/exception/RequestHeaderFieldsTooLargeException.js +28 -0
- package/dist/exception/StatusChecker.d.ts +20 -0
- package/dist/exception/StatusChecker.js +98 -0
- package/dist/exception/TooManyRequestsException.d.ts +20 -0
- package/dist/exception/TooManyRequestsException.js +28 -0
- package/dist/exception/UnauthorizedException.d.ts +20 -0
- package/dist/exception/UnauthorizedException.js +28 -0
- package/dist/exception/UnsupportedException.d.ts +20 -0
- package/dist/exception/UnsupportedException.js +28 -0
- package/dist/exception/index.d.ts +29 -0
- package/dist/exception/index.js +46 -0
- package/dist/index.d.ts +22 -0
- package/dist/index.js +39 -0
- package/dist/message/Message.d.ts +38 -0
- package/dist/message/Message.js +57 -0
- package/dist/message/MessageId.d.ts +59 -0
- package/dist/message/MessageId.js +123 -0
- package/dist/message/MessageView.d.ts +38 -0
- package/dist/message/MessageView.js +90 -0
- package/dist/message/PublishingMessage.d.ts +30 -0
- package/dist/message/PublishingMessage.js +100 -0
- package/dist/message/index.d.ts +20 -0
- package/dist/message/index.js +37 -0
- package/dist/producer/Producer.d.ts +55 -0
- package/dist/producer/Producer.js +318 -0
- package/dist/producer/PublishingLoadBalancer.d.ts +24 -0
- package/dist/producer/PublishingLoadBalancer.js +82 -0
- package/dist/producer/PublishingSettings.d.ts +28 -0
- package/dist/producer/PublishingSettings.js +70 -0
- package/dist/producer/RecallReceipt.d.ts +25 -0
- package/dist/producer/RecallReceipt.js +34 -0
- package/dist/producer/SendReceipt.d.ts +29 -0
- package/dist/producer/SendReceipt.js +60 -0
- package/dist/producer/Transaction.d.ts +28 -0
- package/dist/producer/Transaction.js +70 -0
- package/dist/producer/TransactionChecker.d.ts +21 -0
- package/dist/producer/TransactionChecker.js +19 -0
- package/dist/producer/index.d.ts +22 -0
- package/dist/producer/index.js +40 -0
- package/dist/retry/ExponentialBackoffRetryPolicy.d.ts +27 -0
- package/dist/retry/ExponentialBackoffRetryPolicy.js +64 -0
- package/dist/retry/RetryPolicy.d.ts +46 -0
- package/dist/retry/RetryPolicy.js +19 -0
- package/dist/retry/index.d.ts +18 -0
- package/dist/retry/index.js +35 -0
- package/dist/route/Broker.d.ts +25 -0
- package/dist/route/Broker.js +40 -0
- package/dist/route/Endpoints.d.ts +30 -0
- package/dist/route/Endpoints.js +71 -0
- package/dist/route/MessageQueue.d.ts +27 -0
- package/dist/route/MessageQueue.js +47 -0
- package/dist/route/TopicRouteData.d.ts +24 -0
- package/dist/route/TopicRouteData.js +37 -0
- package/dist/route/index.d.ts +20 -0
- package/dist/route/index.js +37 -0
- package/dist/util/index.d.ts +35 -0
- package/dist/util/index.js +88 -0
- package/package.json +62 -0
- package/proto/apache/rocketmq/v2/admin.proto +43 -0
- package/proto/apache/rocketmq/v2/admin_grpc_pb.d.ts +41 -0
- package/proto/apache/rocketmq/v2/admin_grpc_pb.js +60 -0
- package/proto/apache/rocketmq/v2/admin_pb.d.ts +56 -0
- package/proto/apache/rocketmq/v2/admin_pb.js +340 -0
- package/proto/apache/rocketmq/v2/definition.proto +570 -0
- package/proto/apache/rocketmq/v2/definition_grpc_pb.js +1 -0
- package/proto/apache/rocketmq/v2/definition_pb.d.ts +885 -0
- package/proto/apache/rocketmq/v2/definition_pb.js +6141 -0
- package/proto/apache/rocketmq/v2/service.proto +443 -0
- package/proto/apache/rocketmq/v2/service_grpc_pb.d.ts +294 -0
- package/proto/apache/rocketmq/v2/service_grpc_pb.js +637 -0
- package/proto/apache/rocketmq/v2/service_pb.d.ts +1249 -0
- package/proto/apache/rocketmq/v2/service_pb.js +9723 -0
- package/src/client/BaseClient.ts +404 -0
- package/src/client/ClientId.ts +31 -0
- package/src/client/Logger.ts +36 -0
- package/src/client/RpcClient.ts +258 -0
- package/src/client/RpcClientManager.ts +180 -0
- package/src/client/SessionCredentials.ts +22 -0
- package/src/client/Settings.ts +46 -0
- package/src/client/TelemetrySession.ts +130 -0
- package/src/client/UserAgent.ts +45 -0
- package/src/client/index.ts +27 -0
- package/src/consumer/Assignment.ts +39 -0
- package/src/consumer/Assignments.ts +46 -0
- package/src/consumer/ConsumeResult.ts +21 -0
- package/src/consumer/ConsumeService.ts +54 -0
- package/src/consumer/ConsumeTask.ts +40 -0
- package/src/consumer/Consumer.ts +129 -0
- package/src/consumer/FifoConsumeService.ts +136 -0
- package/src/consumer/FilterExpression.ts +42 -0
- package/src/consumer/MessageListener.ts +23 -0
- package/src/consumer/ProcessQueue.ts +326 -0
- package/src/consumer/PushConsumer.ts +473 -0
- package/src/consumer/PushSubscriptionSettings.ts +123 -0
- package/src/consumer/SimpleConsumer.ts +153 -0
- package/src/consumer/SimpleSubscriptionSettings.ts +64 -0
- package/src/consumer/StandardConsumeService.ts +44 -0
- package/src/consumer/SubscriptionLoadBalancer.ts +47 -0
- package/src/consumer/index.ts +33 -0
- package/src/exception/BadRequestException.ts +25 -0
- package/src/exception/ClientException.ts +29 -0
- package/src/exception/ForbiddenException.ts +25 -0
- package/src/exception/InternalErrorException.ts +25 -0
- package/src/exception/NotFoundException.ts +25 -0
- package/src/exception/PayloadTooLargeException.ts +25 -0
- package/src/exception/PaymentRequiredException.ts +25 -0
- package/src/exception/ProxyTimeoutException.ts +25 -0
- package/src/exception/RequestHeaderFieldsTooLargeException.ts +25 -0
- package/src/exception/StatusChecker.ts +94 -0
- package/src/exception/TooManyRequestsException.ts +25 -0
- package/src/exception/UnauthorizedException.ts +25 -0
- package/src/exception/UnsupportedException.ts +25 -0
- package/src/exception/index.ts +30 -0
- package/src/index.ts +23 -0
- package/src/message/Message.ts +67 -0
- package/src/message/MessageId.ts +123 -0
- package/src/message/MessageView.ts +94 -0
- package/src/message/PublishingMessage.ts +104 -0
- package/src/message/index.ts +21 -0
- package/src/producer/Producer.ts +388 -0
- package/src/producer/PublishingLoadBalancer.ts +85 -0
- package/src/producer/PublishingSettings.ts +78 -0
- package/src/producer/RecallReceipt.ts +32 -0
- package/src/producer/SendReceipt.ts +63 -0
- package/src/producer/Transaction.ts +86 -0
- package/src/producer/TransactionChecker.ts +23 -0
- package/src/producer/index.ts +24 -0
- package/src/retry/ExponentialBackoffRetryPolicy.ts +76 -0
- package/src/retry/RetryPolicy.ts +51 -0
- package/src/retry/index.ts +19 -0
- package/src/route/Broker.ts +39 -0
- package/src/route/Endpoints.ts +70 -0
- package/src/route/MessageQueue.ts +49 -0
- package/src/route/TopicRouteData.ts +38 -0
- package/src/route/index.ts +21 -0
- package/src/util/index.ts +83 -0
|
@@ -0,0 +1,82 @@
|
|
|
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.PublishingLoadBalancer = void 0;
|
|
20
|
+
const node_crypto_1 = require("node:crypto");
|
|
21
|
+
const definition_pb_1 = require("../../proto/apache/rocketmq/v2/definition_pb");
|
|
22
|
+
const util_1 = require("../util");
|
|
23
|
+
class PublishingLoadBalancer {
|
|
24
|
+
#index;
|
|
25
|
+
#messageQueues;
|
|
26
|
+
constructor(topicRouteData, index) {
|
|
27
|
+
this.#messageQueues = topicRouteData.messageQueues.filter(mq => {
|
|
28
|
+
return mq.queueId === util_1.MASTER_BROKER_ID && (mq.permission === definition_pb_1.Permission.WRITE || mq.permission === definition_pb_1.Permission.READ_WRITE);
|
|
29
|
+
});
|
|
30
|
+
this.#index = index === undefined ? (0, node_crypto_1.randomInt)(this.#messageQueues.length) : index;
|
|
31
|
+
if (this.#messageQueues.length === 0) {
|
|
32
|
+
throw new Error(`No writable message queue found, topicRouteData=${JSON.stringify(topicRouteData)}`);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
update(topicRouteData) {
|
|
36
|
+
return new PublishingLoadBalancer(topicRouteData, this.#index);
|
|
37
|
+
}
|
|
38
|
+
takeMessageQueues(excluded, count) {
|
|
39
|
+
if (this.#index >= this.#messageQueues.length) {
|
|
40
|
+
this.#index = 0;
|
|
41
|
+
}
|
|
42
|
+
let next = this.#index++;
|
|
43
|
+
const candidates = [];
|
|
44
|
+
const candidateBrokerNames = new Set();
|
|
45
|
+
const size = this.#messageQueues.length;
|
|
46
|
+
for (let i = 0; i < size; i++) {
|
|
47
|
+
const messageQueue = this.#messageQueues[next++ % size];
|
|
48
|
+
const broker = messageQueue.broker;
|
|
49
|
+
const brokerName = broker.name;
|
|
50
|
+
if (!excluded.has(broker.endpoints.facade) && !candidateBrokerNames.has(brokerName)) {
|
|
51
|
+
candidateBrokerNames.add(brokerName);
|
|
52
|
+
candidates.push(messageQueue);
|
|
53
|
+
}
|
|
54
|
+
if (candidates.length >= count) {
|
|
55
|
+
return candidates;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
// If all endpoints are isolated.
|
|
59
|
+
if (candidates.length === 0) {
|
|
60
|
+
for (let i = 0; i < size; i++) {
|
|
61
|
+
const messageQueue = this.#messageQueues[next++ % size];
|
|
62
|
+
const broker = messageQueue.broker;
|
|
63
|
+
const brokerName = broker.name;
|
|
64
|
+
if (!candidateBrokerNames.has(brokerName)) {
|
|
65
|
+
candidateBrokerNames.add(brokerName);
|
|
66
|
+
candidates.push(messageQueue);
|
|
67
|
+
}
|
|
68
|
+
if (candidates.length >= count) {
|
|
69
|
+
return candidates;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
return candidates;
|
|
74
|
+
}
|
|
75
|
+
takeMessageQueueByMessageGroup(messageGroup) {
|
|
76
|
+
const hashCode = (0, util_1.calculateStringSipHash24)(messageGroup);
|
|
77
|
+
const index = parseInt(`${hashCode % BigInt(this.#messageQueues.length)}`);
|
|
78
|
+
return this.#messageQueues[index];
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
exports.PublishingLoadBalancer = PublishingLoadBalancer;
|
|
82
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiUHVibGlzaGluZ0xvYWRCYWxhbmNlci5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9wcm9kdWNlci9QdWJsaXNoaW5nTG9hZEJhbGFuY2VyLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQTs7Ozs7Ozs7Ozs7Ozs7O0dBZUc7OztBQUVILDZDQUF3QztBQUN4QyxnRkFBMEU7QUFFMUUsa0NBQXFFO0FBRXJFLE1BQWEsc0JBQXNCO0lBQ2pDLE1BQU0sQ0FBUztJQUNmLGNBQWMsQ0FBaUI7SUFFL0IsWUFBWSxjQUE4QixFQUFFLEtBQWM7UUFDeEQsSUFBSSxDQUFDLGNBQWMsR0FBRyxjQUFjLENBQUMsYUFBYSxDQUFDLE1BQU0sQ0FBQyxFQUFFLENBQUMsRUFBRTtZQUM3RCxPQUFPLEVBQUUsQ0FBQyxPQUFPLEtBQUssdUJBQWdCLElBQUksQ0FBQyxFQUFFLENBQUMsVUFBVSxLQUFLLDBCQUFVLENBQUMsS0FBSyxJQUFJLEVBQUUsQ0FBQyxVQUFVLEtBQUssMEJBQVUsQ0FBQyxVQUFVLENBQUMsQ0FBQztRQUM1SCxDQUFDLENBQUMsQ0FBQztRQUNILElBQUksQ0FBQyxNQUFNLEdBQUcsS0FBSyxLQUFLLFNBQVMsQ0FBQyxDQUFDLENBQUMsSUFBQSx1QkFBUyxFQUFDLElBQUksQ0FBQyxjQUFjLENBQUMsTUFBTSxDQUFDLENBQUMsQ0FBQyxDQUFDLEtBQUssQ0FBQztRQUNsRixJQUFJLElBQUksQ0FBQyxjQUFjLENBQUMsTUFBTSxL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QixPQUFPLFVBQVUsQ0FBQztnQkFDcEIsQ0FBQztZQUNILENBQUM7UUFDSCxDQUFDO1FBQ0QsT0FBTyxVQUFVLENBQUM7SUFDcEIsQ0FBQztJQUVELDhCQUE4QixDQUFDLFlBQW9CO1FBQ2pELE1BQU0sUUFBUSxHQUFHLElBQUEsK0JBQXdCLEVBQUMsWUFBWSxDQUFDLENBQUM7UUFDeEQsTUFBTSxLQUFLLEdBQUcsUUFBUSxDQUFDLEdBQUcsUUFBUSxHQUFHLE1BQU0sQ0FBQyxJQUFJLENBQUMsY0FBYyxDQUFDLE1BQU0sQ0FBQyxFQUFFLENBQUMsQ0FBQztRQUMzRSxPQUFPLElBQUksQ0FBQyxjQUFjLENBQUMsS0FBSyxDQUFDLENBQUM7SUFDcEMsQ0FBQztDQUNGO0FBOURELHdEQThEQyJ9
|
|
@@ -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 { Settings as SettingsPB } from '../../proto/apache/rocketmq/v2/definition_pb';
|
|
18
|
+
import { Endpoints } from '../route';
|
|
19
|
+
import { ExponentialBackoffRetryPolicy } from '../retry';
|
|
20
|
+
import { Settings } from '../client';
|
|
21
|
+
export declare class PublishingSettings extends Settings {
|
|
22
|
+
#private;
|
|
23
|
+
constructor(namespace: string, clientId: string, accessPoint: Endpoints, retryPolicy: ExponentialBackoffRetryPolicy, requestTimeout: number, topics: Set<string>);
|
|
24
|
+
get maxBodySizeBytes(): number;
|
|
25
|
+
isValidateMessageType(): boolean;
|
|
26
|
+
toProtobuf(): SettingsPB;
|
|
27
|
+
sync(settings: SettingsPB): void;
|
|
28
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
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.PublishingSettings = void 0;
|
|
20
|
+
const definition_pb_1 = require("../../proto/apache/rocketmq/v2/definition_pb");
|
|
21
|
+
const client_1 = require("../client");
|
|
22
|
+
const util_1 = require("../util");
|
|
23
|
+
class PublishingSettings extends client_1.Settings {
|
|
24
|
+
#topics;
|
|
25
|
+
/**
|
|
26
|
+
* If message body size exceeds the threshold, it would be compressed for convenience of transport.
|
|
27
|
+
* https://rocketmq.apache.org/docs/introduction/03limits/
|
|
28
|
+
* Default max message size is 4 MB
|
|
29
|
+
*/
|
|
30
|
+
#maxBodySizeBytes = 4 * 1024 * 1024;
|
|
31
|
+
#validateMessageType = true;
|
|
32
|
+
constructor(namespace, clientId, accessPoint, retryPolicy, requestTimeout, topics) {
|
|
33
|
+
super(namespace, clientId, definition_pb_1.ClientType.PRODUCER, accessPoint, requestTimeout, retryPolicy);
|
|
34
|
+
this.#topics = topics;
|
|
35
|
+
}
|
|
36
|
+
get maxBodySizeBytes() {
|
|
37
|
+
return this.#maxBodySizeBytes;
|
|
38
|
+
}
|
|
39
|
+
isValidateMessageType() {
|
|
40
|
+
return this.#validateMessageType;
|
|
41
|
+
}
|
|
42
|
+
toProtobuf() {
|
|
43
|
+
const publishing = new definition_pb_1.Publishing()
|
|
44
|
+
.setValidateMessageType(this.#validateMessageType);
|
|
45
|
+
for (const topic of this.#topics) {
|
|
46
|
+
publishing.addTopics().setName(topic).setResourceNamespace(this.namespace);
|
|
47
|
+
}
|
|
48
|
+
return new definition_pb_1.Settings()
|
|
49
|
+
.setClientType(this.clientType)
|
|
50
|
+
.setAccessPoint(this.accessPoint.toProtobuf())
|
|
51
|
+
.setRequestTimeout((0, util_1.createDuration)(this.requestTimeout))
|
|
52
|
+
.setPublishing(publishing)
|
|
53
|
+
.setUserAgent(client_1.UserAgent.INSTANCE.toProtobuf());
|
|
54
|
+
}
|
|
55
|
+
sync(settings) {
|
|
56
|
+
if (settings.getPubSubCase() !== definition_pb_1.Settings.PubSubCase.PUBLISHING) {
|
|
57
|
+
// log.error("[Bug] Issued settings not match with the client type, clientId={}, pubSubCase={}, "
|
|
58
|
+
// + "clientType={}", clientId, pubSubCase, clientType);
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
const backoffPolicy = settings.getBackoffPolicy();
|
|
62
|
+
const publishing = settings.getPublishing().toObject();
|
|
63
|
+
const exist = this.retryPolicy;
|
|
64
|
+
this.retryPolicy = exist.inheritBackoff(backoffPolicy);
|
|
65
|
+
this.#validateMessageType = publishing.validateMessageType;
|
|
66
|
+
this.#max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HQUFHLEtBQUssQ0FBQyxjQUFjLENBQUMsYUFBYSxDQUFDLENBQUM7UUFDdkQsSUFBSSxDQUFDLG9CQUFvQixHQUFHLFVBQVUsQ0FBQyxtQkFBbUIsQ0FBQztRQUMzRCxJQUFJLENBQUMsaUJBQWlCLEdBQUcsVUFBVSxDQUFDLFdBQVcsQ0FBQztJQUNsRCxDQUFDO0NBQ0Y7QUFsREQsZ0RBa0RDIn0=
|
|
@@ -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
|
+
/**
|
|
18
|
+
* Represents the receipt returned after successfully recalling a scheduled/delayed message.
|
|
19
|
+
* Contains the message ID of the recalled message.
|
|
20
|
+
*/
|
|
21
|
+
export declare class RecallReceipt {
|
|
22
|
+
readonly messageId: string;
|
|
23
|
+
constructor(messageId: string);
|
|
24
|
+
toString(): string;
|
|
25
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
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.RecallReceipt = void 0;
|
|
20
|
+
/**
|
|
21
|
+
* Represents the receipt returned after successfully recalling a scheduled/delayed message.
|
|
22
|
+
* Contains the message ID of the recalled message.
|
|
23
|
+
*/
|
|
24
|
+
class RecallReceipt {
|
|
25
|
+
messageId;
|
|
26
|
+
constructor(messageId) {
|
|
27
|
+
this.messageId = messageId;
|
|
28
|
+
}
|
|
29
|
+
toString() {
|
|
30
|
+
return `RecallReceipt{messageId='${this.messageId}'}`;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
exports.RecallReceipt = RecallReceipt;
|
|
34
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiUmVjYWxsUmVjZWlwdC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9wcm9kdWNlci9SZWNhbGxSZWNlaXB0LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQTs7Ozs7Ozs7Ozs7Ozs7O0dBZUc7OztBQUVIOzs7R0FHRztBQUNILE1BQWEsYUFBYTtJQUNmLFNBQVMsQ0FBUztJQUUzQixZQUFZLFNBQWlCO1FBQzNCLElBQUksQ0FBQyxTQUFTLEdBQUcsU0FBUyxDQUFDO0lBQzdCLENBQUM7SUFFRCxRQUFRO1FBQ04sT0FBTyw0QkFBNEIsSUFBSSxDQUFDLFNBQVMsSUFBSSxDQUFDO0lBQ3hELENBQUM7Q0FDRjtBQVZELHNDQVVDIn0=
|
|
@@ -0,0 +1,29 @@
|
|
|
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 { SendMessageResponse } from '../../proto/apache/rocketmq/v2/service_pb';
|
|
18
|
+
import { MessageQueue } from '../route';
|
|
19
|
+
export declare class SendReceipt {
|
|
20
|
+
#private;
|
|
21
|
+
readonly messageId: string;
|
|
22
|
+
readonly transactionId: string;
|
|
23
|
+
readonly recallHandle: string;
|
|
24
|
+
readonly offset: number;
|
|
25
|
+
constructor(messageId: string, transactionId: string, recallHandle: string, messageQueue: MessageQueue, offset: number);
|
|
26
|
+
get messageQueue(): MessageQueue;
|
|
27
|
+
get endpoints(): import("../route").Endpoints;
|
|
28
|
+
static processResponseInvocation(mq: MessageQueue, response: SendMessageResponse): SendReceipt[];
|
|
29
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
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.SendReceipt = void 0;
|
|
20
|
+
const definition_pb_1 = require("../../proto/apache/rocketmq/v2/definition_pb");
|
|
21
|
+
const exception_1 = require("../exception");
|
|
22
|
+
class SendReceipt {
|
|
23
|
+
messageId;
|
|
24
|
+
transactionId;
|
|
25
|
+
recallHandle;
|
|
26
|
+
offset;
|
|
27
|
+
#messageQueue;
|
|
28
|
+
constructor(messageId, transactionId, recallHandle, messageQueue, offset) {
|
|
29
|
+
this.messageId = messageId;
|
|
30
|
+
this.transactionId = transactionId;
|
|
31
|
+
this.recallHandle = recallHandle;
|
|
32
|
+
this.offset = offset;
|
|
33
|
+
this.#messageQueue = messageQueue;
|
|
34
|
+
}
|
|
35
|
+
get messageQueue() {
|
|
36
|
+
return this.#messageQueue;
|
|
37
|
+
}
|
|
38
|
+
get endpoints() {
|
|
39
|
+
return this.#messageQueue.broker.endpoints;
|
|
40
|
+
}
|
|
41
|
+
static processResponseInvocation(mq, response) {
|
|
42
|
+
const responseObj = response.toObject();
|
|
43
|
+
// Filter abnormal status.
|
|
44
|
+
const abnormalStatus = responseObj.entriesList.map(e => e.status).find(s => s?.code !== definition_pb_1.Code.OK);
|
|
45
|
+
const status = abnormalStatus ?? responseObj.status;
|
|
46
|
+
exception_1.StatusChecker.check(status);
|
|
47
|
+
const sendReceipts = [];
|
|
48
|
+
for (const entry of responseObj.entriesList) {
|
|
49
|
+
const messageId = entry.messageId;
|
|
50
|
+
const transactionId = entry.transactionId;
|
|
51
|
+
const recallHandle = entry.recallHandle;
|
|
52
|
+
const offset = entry.offset;
|
|
53
|
+
const sendReceipt = new SendReceipt(messageId, transactionId, recallHandle, mq, offset);
|
|
54
|
+
sendReceipts.push(sendReceipt);
|
|
55
|
+
}
|
|
56
|
+
return sendReceipts;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
exports.SendReceipt = SendReceipt;
|
|
60
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiU2VuZFJlY2VpcHQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvcHJvZHVjZXIvU2VuZFJlY2VpcHQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBOzs7Ozs7Ozs7Ozs7Ozs7R0FlRzs7O0FBRUgsZ0ZBQW9FO0FBR3BFLDRDQUE2QztBQUU3QyxNQUFhLFdBQVc7SUFDYixTQUFTLENBQVM7SUFDbEIsYUFBYSxDQUFTO0lBQ3RCLFlBQVksQ0FBUztJQUNyQixNQUFNLENBQVM7SUFDZixhQUFhLENBQWU7SUFFckMsWUFBWSxTQUFpQixFQUFFLGFBQXFCLEVBQUUsWUFBb0IsRUFBRSxZQUEwQixFQUFFLE1BQWM7UUFDcEgsSUFBSSxDQUFDLFNBQVMsR0FBRyxTQUFTLENBQUM7UUFDM0IsSUFBSSxDQUFDLGFBQWEsR0FBRyxhQUFhLENBQUM7UUFDbkMsSUFBSSxDQUFDLFlBQVksR0FBRyxZQUFZLENBQUM7UUFDakMsSUFBSSxDQUFDLE1BQU0sR0FBRyxNQUFNLENBQUM7UUFDckIsSUFBSSxDQUFDLGFBQWEsR0F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UFNLFdBQVcsR0FBRyxJQUFJLFdBQVcsQ0FBQyxTQUFTLEVBQUUsYUFBYSxFQUFFLFlBQVksRUFBRSxFQUFFLEVBQUUsTUFBTSxDQUFDLENBQUM7WUFDeEYsWUFBWSxDQUFDLElBQUksQ0FBQyxXQUFXLENBQUMsQ0FBQztRQUNqQyxDQUFDO1FBQ0QsT0FBTyxZQUFZLENBQUM7SUFDdEIsQ0FBQztDQUNGO0FBeENELGtDQXdDQyJ9
|
|
@@ -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 { MessageOptions, PublishingMessage } from '../message';
|
|
18
|
+
import type { Producer } from './Producer';
|
|
19
|
+
import { SendReceipt } from './SendReceipt';
|
|
20
|
+
export declare class Transaction {
|
|
21
|
+
#private;
|
|
22
|
+
static readonly MAX_MESSAGE_NUM = 1;
|
|
23
|
+
constructor(producer: Producer);
|
|
24
|
+
tryAddMessage(message: MessageOptions): PublishingMessage;
|
|
25
|
+
tryAddReceipt(publishingMessage: PublishingMessage, sendReceipt: SendReceipt): void;
|
|
26
|
+
commit(): Promise<void>;
|
|
27
|
+
rollback(): Promise<void>;
|
|
28
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
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.Transaction = void 0;
|
|
20
|
+
const definition_pb_1 = require("../../proto/apache/rocketmq/v2/definition_pb");
|
|
21
|
+
const message_1 = require("../message");
|
|
22
|
+
class Transaction {
|
|
23
|
+
static MAX_MESSAGE_NUM = 1;
|
|
24
|
+
#producer;
|
|
25
|
+
#messageMap = new Map();
|
|
26
|
+
#messageSendReceiptMap = new Map();
|
|
27
|
+
constructor(producer) {
|
|
28
|
+
this.#producer = producer;
|
|
29
|
+
}
|
|
30
|
+
tryAddMessage(message) {
|
|
31
|
+
if (this.#messageMap.size >= Transaction.MAX_MESSAGE_NUM) {
|
|
32
|
+
throw new TypeError(`Message in transaction has exceeded the threshold=${Transaction.MAX_MESSAGE_NUM}`);
|
|
33
|
+
}
|
|
34
|
+
const publishingMessage = new message_1.PublishingMessage(message, this.#producer.publishingSettings, true);
|
|
35
|
+
this.#messageMap.set(publishingMessage.messageId, publishingMessage);
|
|
36
|
+
return publishingMessage;
|
|
37
|
+
}
|
|
38
|
+
tryAddReceipt(publishingMessage, sendReceipt) {
|
|
39
|
+
if (!this.#messageMap.has(publishingMessage.messageId)) {
|
|
40
|
+
throw new TypeError('Message not in transaction');
|
|
41
|
+
}
|
|
42
|
+
this.#messageSendReceiptMap.set(publishingMessage.messageId, sendReceipt);
|
|
43
|
+
}
|
|
44
|
+
async commit() {
|
|
45
|
+
if (this.#messageSendReceiptMap.size === 0) {
|
|
46
|
+
throw new TypeError('Transactional message has not been sent yet');
|
|
47
|
+
}
|
|
48
|
+
const logger = this.#producer.logger;
|
|
49
|
+
logger.info('Begin to commit transaction, messageCount=%d, clientId=%s', this.#messageSendReceiptMap.size, this.#producer.clientId);
|
|
50
|
+
for (const [messageId, sendReceipt] of this.#messageSendReceiptMap.entries()) {
|
|
51
|
+
const publishingMessage = this.#messageMap.get(messageId);
|
|
52
|
+
await this.#producer.endTransaction(sendReceipt.endpoints, publishingMessage, sendReceipt.messageId, sendReceipt.transactionId, definition_pb_1.TransactionResolution.COMMIT);
|
|
53
|
+
}
|
|
54
|
+
logger.info('Commit transaction successfully, messageCount=%d, clientId=%s', this.#messageSendReceiptMap.size, this.#producer.clientId);
|
|
55
|
+
}
|
|
56
|
+
async rollback() {
|
|
57
|
+
if (this.#messageSendReceiptMap.size === 0) {
|
|
58
|
+
throw new TypeError('Transactional message has not been sent yet');
|
|
59
|
+
}
|
|
60
|
+
const logger = this.#producer.logger;
|
|
61
|
+
logger.info('Begin to rollback transaction, messageCount=%d, clientId=%s', this.#messageSendReceiptMap.size, this.#producer.clientId);
|
|
62
|
+
for (const [messageId, sendReceipt] of this.#messageSendReceiptMap.entries()) {
|
|
63
|
+
const publishingMessage = this.#messageMap.get(messageId);
|
|
64
|
+
await this.#producer.endTransaction(sendReceipt.endpoints, publishingMessage, sendReceipt.messageId, sendReceipt.transactionId, definition_pb_1.TransactionResolution.ROLLBACK);
|
|
65
|
+
}
|
|
66
|
+
logger.info('Rollback transaction successfully, messageCount=%d, clientId=%s', this.#messageSendReceiptMap.size, this.#producer.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0FBQyxRQUFRLENBQUMsQ0FBQztRQUN0RixDQUFDO1FBRUQsTUFBTSxDQUFDLElBQUksQ0FBQyxpRUFBaUUsRUFDM0UsSUFBSSxDQUFDLHNCQUFzQixDQUFDLElBQUksRUFBRyxJQUFJLENBQUMsU0FBaUIsQ0FBQyxRQUFRLENBQUMsQ0FBQztJQUN4RSxDQUFDOztBQTlESCxrQ0ErREMifQ==
|
|
@@ -0,0 +1,21 @@
|
|
|
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 { TransactionResolution } from '../../proto/apache/rocketmq/v2/definition_pb';
|
|
18
|
+
import { MessageView } from '../message';
|
|
19
|
+
export interface TransactionChecker {
|
|
20
|
+
check(messageView: MessageView): Promise<TransactionResolution>;
|
|
21
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
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
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiVHJhbnNhY3Rpb25DaGVja2VyLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL3Byb2R1Y2VyL1RyYW5zYWN0aW9uQ2hlY2tlci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUE7Ozs7Ozs7Ozs7Ozs7OztHQWVHIn0=
|
|
@@ -0,0 +1,22 @@
|
|
|
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 './Producer';
|
|
18
|
+
export * from './PublishingLoadBalancer';
|
|
19
|
+
export * from './PublishingSettings';
|
|
20
|
+
export * from './RecallReceipt';
|
|
21
|
+
export * from './SendReceipt';
|
|
22
|
+
export * from './TransactionChecker';
|
|
@@ -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
|
+
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("./Producer"), exports);
|
|
34
|
+
__exportStar(require("./PublishingLoadBalancer"), exports);
|
|
35
|
+
__exportStar(require("./PublishingSettings"), exports);
|
|
36
|
+
__exportStar(require("./RecallReceipt"), exports);
|
|
37
|
+
__exportStar(require("./SendReceipt"), exports);
|
|
38
|
+
// export * from './Transaction';
|
|
39
|
+
__exportStar(require("./TransactionChecker"), exports);
|
|
40
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvcHJvZHVjZXIvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBOzs7Ozs7Ozs7Ozs7Ozs7R0FlRzs7Ozs7Ozs7Ozs7Ozs7OztBQUVILDZDQUEyQjtBQUMzQiwyREFBeUM7QUFDekMsdURBQXFDO0FBQ3JDLGtEQUFnQztBQUNoQyxnREFBOEI7QUFDOUIsaUNBQWlDO0FBQ2pDLHVEQUFxQyJ9
|
|
@@ -0,0 +1,27 @@
|
|
|
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 { RetryPolicy as RetryPolicyPB } from '../../proto/apache/rocketmq/v2/definition_pb';
|
|
18
|
+
import { RetryPolicy } from './RetryPolicy';
|
|
19
|
+
export declare class ExponentialBackoffRetryPolicy implements RetryPolicy {
|
|
20
|
+
#private;
|
|
21
|
+
constructor(maxAttempts: number, initialBackoff?: number, maxBackoff?: number, backoffMultiplier?: number);
|
|
22
|
+
static immediatelyRetryPolicy(maxAttempts: number): ExponentialBackoffRetryPolicy;
|
|
23
|
+
getMaxAttempts(): number;
|
|
24
|
+
getNextAttemptDelay(attempt: number): number;
|
|
25
|
+
inheritBackoff(retryPolicy: RetryPolicyPB): RetryPolicy;
|
|
26
|
+
toProtobuf(): RetryPolicyPB;
|
|
27
|
+
}
|