rocketmq-client-nodejs 1.0.5 → 1.0.7
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/dist/consumer/ConsumeResult.d.ts +38 -3
- package/dist/consumer/ConsumeResult.js +58 -7
- package/dist/consumer/FifoConsumeService.d.ts +33 -1
- package/dist/consumer/FifoConsumeService.js +72 -87
- package/dist/consumer/LiteFifoConsumeService.d.ts +44 -0
- package/dist/consumer/LiteFifoConsumeService.js +94 -0
- package/dist/consumer/LitePushConsumer.d.ts +14 -0
- package/dist/consumer/LitePushConsumer.js +25 -4
- package/dist/consumer/LitePushConsumerImpl.d.ts +9 -0
- package/dist/consumer/LitePushConsumerImpl.js +30 -1
- package/dist/consumer/LiteStandardConsumeService.d.ts +32 -0
- package/dist/consumer/LiteStandardConsumeService.js +63 -0
- package/dist/consumer/LiteSubscriptionManager.js +3 -1
- package/dist/consumer/ProcessQueue.js +50 -6
- package/dist/consumer/PushConsumer.d.ts +1 -0
- package/dist/consumer/PushConsumer.js +5 -4
- package/dist/consumer/index.d.ts +2 -0
- package/dist/consumer/index.js +3 -1
- package/dist/message/MessageView.d.ts +8 -1
- package/dist/message/MessageView.js +11 -1
- package/package.json +1 -1
- package/proto/apache/rocketmq/v2/definition.proto +1 -1
- package/src/consumer/ConsumeResult.ts +62 -3
- package/src/consumer/FifoConsumeService.ts +78 -93
- package/src/consumer/LiteFifoConsumeService.ts +103 -0
- package/src/consumer/LitePushConsumer.ts +29 -3
- package/src/consumer/LitePushConsumerImpl.ts +36 -0
- package/src/consumer/LiteStandardConsumeService.ts +73 -0
- package/src/consumer/LiteSubscriptionManager.ts +2 -0
- package/src/consumer/ProcessQueue.ts +65 -6
- package/src/consumer/PushConsumer.ts +4 -3
- package/src/consumer/index.ts +2 -0
- package/src/message/MessageView.ts +12 -1
|
@@ -199,6 +199,16 @@ class MessageView {
|
|
|
199
199
|
getDeliveryAttempt() {
|
|
200
200
|
return this.deliveryAttempt;
|
|
201
201
|
}
|
|
202
|
+
/**
|
|
203
|
+
* Increment the delivery attempt and return the new value.
|
|
204
|
+
* Used by FIFO retry logic to track redelivery attempts.
|
|
205
|
+
*
|
|
206
|
+
* @return the incremented delivery attempt
|
|
207
|
+
*/
|
|
208
|
+
incrementAndGetDeliveryAttempt() {
|
|
209
|
+
this.deliveryAttempt = (this.deliveryAttempt ?? 0) + 1;
|
|
210
|
+
return this.deliveryAttempt;
|
|
211
|
+
}
|
|
202
212
|
}
|
|
203
213
|
exports.MessageView = MessageView;
|
|
204
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
214
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiTWVzc2FnZVZpZXcuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvbWVzc2FnZS9NZXNzYWdlVmlldy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUE7Ozs7Ozs7Ozs7Ozs7OztHQWVHOzs7QUFFSCx5Q0FBdUM7QUFDdkMsZ0ZBSXNEO0FBQ3RELGtDQUFtRTtBQUduRSxNQUFhLFdBQVc7SUFDYixTQUFTLENBQVM7SUFDbEIsS0FBSyxDQUFTO0lBQ2QsSUFBSSxDQUFTO0lBQ2IsU0FBUyxDQUFVO0lBQ25CLDBCQUEwQixDQUFRO0lBQ2xDLEdBQUcsQ0FBVTtJQUNiLFlBQVksQ0FBVTtJQUN0QixpQkFBaUIsQ0FBUTtJQUN6QixJQUFJLENBQVc7SUFDZixRQUFRLENBQVM7SUFDakIsYUFBYSxDQUFRO0lBQzlCLGVBQWUsQ0FBVTtJQUNoQixTQUFTLENBQVk7SUFDckIsYUFBYSxDQUFTO0lBQ3RCLE1BQU0sQ0FBVTtJQUNoQixlQUFlLENBQU87SUFDdEIsVUFBVSxHQUFHLElBQUksR0FBRyxFQUFrQixDQUFDO0lBQ3ZDLFNBQVMsQ0FBVTtJQUNuQixRQU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
|
19
|
-
|
|
20
|
-
|
|
18
|
+
/**
|
|
19
|
+
* Consume result for push consumer.
|
|
20
|
+
*
|
|
21
|
+
* <p>Designed for push consumer specifically. This is a class-based result
|
|
22
|
+
* (matching the Java client) so that it can be extended with suspend results.</p>
|
|
23
|
+
*/
|
|
24
|
+
export class ConsumeResult {
|
|
25
|
+
/**
|
|
26
|
+
* Consume message successfully.
|
|
27
|
+
*/
|
|
28
|
+
static readonly SUCCESS = new ConsumeResult('SUCCESS');
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Failed to consume message.
|
|
32
|
+
*/
|
|
33
|
+
static readonly FAILURE = new ConsumeResult('FAILURE');
|
|
34
|
+
|
|
35
|
+
readonly name: string;
|
|
36
|
+
|
|
37
|
+
protected constructor(name: string) {
|
|
38
|
+
this.name = name;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
toString(): string {
|
|
42
|
+
return this.name;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
const MIN_SUSPEND_TIME_MS = 50;
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Suspend consume result.
|
|
50
|
+
*
|
|
51
|
+
* <p>When returned by the message listener, the consumer will suspend
|
|
52
|
+
* consumption of the current message (and related messages in FIFO mode)
|
|
53
|
+
* for the specified duration by changing the invisible duration.</p>
|
|
54
|
+
*/
|
|
55
|
+
export class ConsumeResultSuspend extends ConsumeResult {
|
|
56
|
+
readonly suspendTimeMs: number;
|
|
57
|
+
|
|
58
|
+
private constructor(suspendTimeMs: number) {
|
|
59
|
+
super('SUSPEND');
|
|
60
|
+
if (suspendTimeMs < MIN_SUSPEND_TIME_MS) {
|
|
61
|
+
throw new Error(`suspend time cannot be less than ${MIN_SUSPEND_TIME_MS}ms, got ${suspendTimeMs}ms`);
|
|
62
|
+
}
|
|
63
|
+
this.suspendTimeMs = suspendTimeMs;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Create a suspend result with the given suspend time in milliseconds.
|
|
68
|
+
*
|
|
69
|
+
* @param suspendTimeMs - Suspend time in milliseconds
|
|
70
|
+
* @return {ConsumeResultSuspend} ConsumeResultSuspend instance
|
|
71
|
+
* @throws {Error} if suspendTimeMs is less than 50ms
|
|
72
|
+
*/
|
|
73
|
+
static of(suspendTimeMs: number): ConsumeResultSuspend {
|
|
74
|
+
return new ConsumeResultSuspend(suspendTimeMs);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
toString(): string {
|
|
78
|
+
return `SUSPEND(${this.suspendTimeMs}ms)`;
|
|
79
|
+
}
|
|
21
80
|
}
|
|
@@ -22,125 +22,110 @@ import type { ProcessQueue } from './ProcessQueue';
|
|
|
22
22
|
import { ILogger, getDefaultLogger } from '../client/Logger';
|
|
23
23
|
|
|
24
24
|
export class FifoConsumeService extends ConsumeService {
|
|
25
|
-
readonly #
|
|
26
|
-
readonly #groupProcessing = new Map<string /* messageGroup */, Promise<void>>();
|
|
25
|
+
readonly #enableFifoConsumeAccelerator: boolean;
|
|
27
26
|
readonly #logger: ILogger;
|
|
28
27
|
|
|
29
|
-
constructor(clientId: string, messageListener: MessageListener,
|
|
28
|
+
constructor(clientId: string, messageListener: MessageListener, enableFifoConsumeAccelerator?: boolean) {
|
|
30
29
|
super(clientId, messageListener);
|
|
31
|
-
this.#
|
|
30
|
+
this.#enableFifoConsumeAccelerator = enableFifoConsumeAccelerator ?? false;
|
|
32
31
|
this.#logger = getDefaultLogger();
|
|
33
32
|
}
|
|
34
33
|
|
|
35
34
|
consume(pq: ProcessQueue, messageViews: MessageView[]): void {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
35
|
+
if (!pq || !messageViews) {
|
|
36
|
+
this.#logger.error('[Bug] Invalid arguments for consume, pq=%s, messageViews=%s, clientId=%s',
|
|
37
|
+
pq, messageViews, this.clientId);
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
if (!this.#enableFifoConsumeAccelerator || messageViews.length <= 1) {
|
|
41
|
+
this.consumeIteratively(pq, messageViews, 0).catch(() => {
|
|
42
|
+
// Error already logged, ignore
|
|
43
|
+
});
|
|
39
44
|
return;
|
|
40
45
|
}
|
|
41
|
-
this.#consumeWithAccelerator(pq, messageViews);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* FIFO consume accelerator mode:
|
|
46
|
-
* - Messages with the same messageGroup are consumed sequentially
|
|
47
|
-
* - Messages with different messageGroups are consumed in parallel
|
|
48
|
-
* - Messages without messageGroup are consumed in parallel
|
|
49
|
-
*/
|
|
50
|
-
#consumeWithAccelerator(pq: ProcessQueue, messageViews: MessageView[]): void {
|
|
51
|
-
// Group messages by messageGroup
|
|
52
|
-
const groupedMessages = new Map<string, MessageView[]>();
|
|
53
|
-
const ungroupedMessages: MessageView[] = [];
|
|
54
46
|
|
|
47
|
+
// Group messages by group key. Default to null-key group for unkeyed messages.
|
|
48
|
+
const messageViewsGroupByGroupKey = new Map<string, MessageView[]>();
|
|
55
49
|
for (const messageView of messageViews) {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
const messageGroup = messageView.messageGroup || '';
|
|
62
|
-
if (messageGroup) {
|
|
63
|
-
const group = groupedMessages.get(messageGroup) || [];
|
|
64
|
-
group.push(messageView);
|
|
65
|
-
groupedMessages.set(messageGroup, group);
|
|
66
|
-
} else {
|
|
67
|
-
ungroupedMessages.push(messageView);
|
|
50
|
+
const groupKey = this.getMessageGroupKey(messageView);
|
|
51
|
+
let group = messageViewsGroupByGroupKey.get(groupKey);
|
|
52
|
+
if (!group) {
|
|
53
|
+
group = [];
|
|
54
|
+
messageViewsGroupByGroupKey.set(groupKey, group);
|
|
68
55
|
}
|
|
56
|
+
group.push(messageView);
|
|
69
57
|
}
|
|
70
58
|
|
|
71
|
-
// Log parallel consumption info
|
|
72
|
-
const groupCount = groupedMessages.size + (ungroupedMessages.length > 0 ? 1 : 0);
|
|
73
59
|
this.#logger.debug?.('FifoConsumeService parallel consume, messageViewsNum=%d, groupNum=%d',
|
|
74
|
-
messageViews.length,
|
|
75
|
-
|
|
76
|
-
// Process grouped messages (each group sequentially, groups in parallel)
|
|
77
|
-
for (const [ , messages ] of groupedMessages.entries()) {
|
|
78
|
-
this.#processMessageGroup(pq, messages);
|
|
79
|
-
}
|
|
60
|
+
messageViews.length, messageViewsGroupByGroupKey.size);
|
|
80
61
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
.catch(() => {
|
|
86
|
-
// Error already logged, continue with next message
|
|
87
|
-
});
|
|
62
|
+
for (const list of messageViewsGroupByGroupKey.values()) {
|
|
63
|
+
this.consumeIteratively(pq, list, 0).catch(() => {
|
|
64
|
+
// Error already logged, ignore
|
|
65
|
+
});
|
|
88
66
|
}
|
|
89
67
|
}
|
|
90
68
|
|
|
91
69
|
/**
|
|
92
|
-
*
|
|
70
|
+
* Get the group key for the given message view.
|
|
71
|
+
* Subclasses can override this method to provide different grouping logic.
|
|
72
|
+
*
|
|
73
|
+
* @param messageView - The message view
|
|
74
|
+
* @return {string} The group key, empty string means no grouping
|
|
93
75
|
*/
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
const messageGroup = messages[0]?.messageGroup || 'NO_GROUP';
|
|
97
|
-
const existingPromise = this.#groupProcessing.get(messageGroup);
|
|
98
|
-
const processTask = (async () => {
|
|
99
|
-
// Wait for previous processing to complete if any
|
|
100
|
-
if (existingPromise) {
|
|
101
|
-
await existingPromise.catch(() => {
|
|
102
|
-
// Ignore previous errors, continue processing
|
|
103
|
-
});
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
// Process messages in sequence
|
|
107
|
-
for (const messageView of messages) {
|
|
108
|
-
try {
|
|
109
|
-
const result = await this.consumeMessage(messageView);
|
|
110
|
-
await pq.eraseFifoMessage(messageView, result);
|
|
111
|
-
} catch (error) {
|
|
112
|
-
this.#logger.error('Failed to process FIFO message, messageGroup=%s, messageId=%s, error=%s',
|
|
113
|
-
messageGroup, messageView.messageId, error);
|
|
114
|
-
// Continue with next message even if current fails
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
})();
|
|
118
|
-
|
|
119
|
-
// Store the promise for this group
|
|
120
|
-
this.#groupProcessing.set(messageGroup, processTask);
|
|
121
|
-
|
|
122
|
-
// Clean up when done
|
|
123
|
-
processTask.finally(() => {
|
|
124
|
-
this.#groupProcessing.delete(messageGroup);
|
|
125
|
-
});
|
|
76
|
+
protected getMessageGroupKey(messageView: MessageView): string {
|
|
77
|
+
return messageView.messageGroup || '';
|
|
126
78
|
}
|
|
127
79
|
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
80
|
+
/**
|
|
81
|
+
* Consume messages iteratively using the provided message view array.
|
|
82
|
+
* This method handles corrupted messages and continues processing the next valid message.
|
|
83
|
+
*
|
|
84
|
+
* @param pq - The process queue
|
|
85
|
+
* @param messageViews - The message views to consume
|
|
86
|
+
* @param startIndex - The index to start consuming from
|
|
87
|
+
* @return {Promise<void>} Promise that resolves when all messages are consumed
|
|
88
|
+
*/
|
|
89
|
+
protected consumeIteratively(pq: ProcessQueue, messageViews: MessageView[], startIndex: number): Promise<void> {
|
|
90
|
+
const next = this.getNextValidMessage(pq, messageViews, startIndex);
|
|
91
|
+
if (!next) {
|
|
92
|
+
return Promise.resolve();
|
|
131
93
|
}
|
|
94
|
+
const { messageView, nextIndex } = next;
|
|
132
95
|
|
|
133
|
-
|
|
96
|
+
return this.consumeMessage(messageView)
|
|
97
|
+
.then(result => pq.eraseFifoMessage(messageView, result))
|
|
98
|
+
.then(() => this.consumeIteratively(pq, messageViews, nextIndex))
|
|
99
|
+
.catch(() => this.consumeIteratively(pq, messageViews, nextIndex));
|
|
100
|
+
}
|
|
134
101
|
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
102
|
+
/**
|
|
103
|
+
* Get the next valid message from the message view array.
|
|
104
|
+
* Skip corrupted messages and return the first valid one.
|
|
105
|
+
* Returns null if there are no more messages.
|
|
106
|
+
*
|
|
107
|
+
* @param pq - The process queue
|
|
108
|
+
* @param messageViews - The message views
|
|
109
|
+
* @param startIndex - The index to start searching from
|
|
110
|
+
* @return {{ messageView: MessageView; nextIndex: number } | null} The next valid message and the index after it, or null
|
|
111
|
+
*/
|
|
112
|
+
protected getNextValidMessage(
|
|
113
|
+
pq: ProcessQueue,
|
|
114
|
+
messageViews: MessageView[],
|
|
115
|
+
startIndex: number,
|
|
116
|
+
): { messageView: MessageView; nextIndex: number } | null {
|
|
117
|
+
for (let i = startIndex; i < messageViews.length; i++) {
|
|
118
|
+
const messageView = messageViews[i];
|
|
119
|
+
if (messageView.corrupted) {
|
|
120
|
+
// Discard corrupted message.
|
|
121
|
+
this.#logger.error('Message is corrupted for FIFO consumption, prepare to discard it, mq=%s, '
|
|
122
|
+
+ 'messageId=%s, clientId=%s',
|
|
123
|
+
pq.getMessageQueue(), messageView.messageId, this.clientId);
|
|
124
|
+
pq.discardFifoMessage(messageView);
|
|
125
|
+
continue;
|
|
126
|
+
}
|
|
127
|
+
return { messageView, nextIndex: i + 1 };
|
|
139
128
|
}
|
|
140
|
-
|
|
141
|
-
this.consumeMessage(messageView)
|
|
142
|
-
.then(result => pq.eraseFifoMessage(messageView, result))
|
|
143
|
-
.then(() => this.#consumeIteratively(pq, messageViews, index + 1))
|
|
144
|
-
.catch(() => this.#consumeIteratively(pq, messageViews, index + 1));
|
|
129
|
+
return null;
|
|
145
130
|
}
|
|
146
131
|
}
|
|
@@ -0,0 +1,103 @@
|
|
|
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
|
+
import { MessageView } from '../message';
|
|
19
|
+
import { ConsumeResultSuspend } from './ConsumeResult';
|
|
20
|
+
import { FifoConsumeService } from './FifoConsumeService';
|
|
21
|
+
import { MessageListener } from './MessageListener';
|
|
22
|
+
import type { ProcessQueue } from './ProcessQueue';
|
|
23
|
+
import { ILogger, getDefaultLogger } from '../client/Logger';
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* FIFO consume service for lite push consumer.
|
|
27
|
+
*
|
|
28
|
+
* <p>Similar to {@link FifoConsumeService}, but groups messages by lite topic
|
|
29
|
+
* instead of message group. This ensures messages with the same lite topic are
|
|
30
|
+
* consumed sequentially, while messages with different lite topics can be
|
|
31
|
+
* consumed in parallel when the accelerator is enabled.</p>
|
|
32
|
+
*
|
|
33
|
+
* <p>When the message listener returns {@link ConsumeResultSuspend}, all
|
|
34
|
+
* remaining messages with the same lite topic in the current batch are also
|
|
35
|
+
* suspended, while messages with different lite topics continue to be consumed.</p>
|
|
36
|
+
*/
|
|
37
|
+
export class LiteFifoConsumeService extends FifoConsumeService {
|
|
38
|
+
readonly #logger: ILogger;
|
|
39
|
+
|
|
40
|
+
constructor(clientId: string, messageListener: MessageListener, enableFifoConsumeAccelerator?: boolean) {
|
|
41
|
+
super(clientId, messageListener, enableFifoConsumeAccelerator);
|
|
42
|
+
this.#logger = getDefaultLogger();
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Use lite topic as the group key for FIFO consumption.
|
|
47
|
+
*
|
|
48
|
+
* @param messageView - The message view
|
|
49
|
+
* @return {string} The lite topic, empty string if not present
|
|
50
|
+
*/
|
|
51
|
+
protected getMessageGroupKey(messageView: MessageView): string {
|
|
52
|
+
return messageView.liteTopic || '';
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
protected consumeIteratively(pq: ProcessQueue, messageViews: MessageView[], startIndex: number): Promise<void> {
|
|
56
|
+
if (!pq || !messageViews) {
|
|
57
|
+
this.#logger.error('[Bug] Invalid arguments for consumeIteratively, pq=%s, messageViews=%s, clientId=%s',
|
|
58
|
+
pq, messageViews, this.clientId);
|
|
59
|
+
return Promise.resolve();
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
const next = this.getNextValidMessage(pq, messageViews, startIndex);
|
|
63
|
+
if (!next) {
|
|
64
|
+
return Promise.resolve();
|
|
65
|
+
}
|
|
66
|
+
const { messageView, nextIndex } = next;
|
|
67
|
+
|
|
68
|
+
return this.consumeMessage(messageView)
|
|
69
|
+
.then(async result => {
|
|
70
|
+
await pq.eraseFifoMessage(messageView, result);
|
|
71
|
+
return result;
|
|
72
|
+
})
|
|
73
|
+
.then(async result => {
|
|
74
|
+
if (result instanceof ConsumeResultSuspend) {
|
|
75
|
+
const currentLiteTopic = messageView.liteTopic ?? '';
|
|
76
|
+
const continuation: MessageView[] = [];
|
|
77
|
+
const suspendTasks: Array<Promise<void>> = [];
|
|
78
|
+
|
|
79
|
+
// Suspend all messages with the same liteTopic in this batch.
|
|
80
|
+
for (let i = nextIndex; i < messageViews.length; i++) {
|
|
81
|
+
const msg = messageViews[i];
|
|
82
|
+
if ((msg.liteTopic ?? '') === currentLiteTopic) {
|
|
83
|
+
suspendTasks.push(pq.eraseFifoMessage(msg, result));
|
|
84
|
+
} else {
|
|
85
|
+
continuation.push(msg);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
this.#logger.debug?.('LiteFifoConsumeService suspend, liteTopic=%s, suspendCount=%d, continuationCount=%d, '
|
|
90
|
+
+ 'clientId=%s', currentLiteTopic, suspendTasks.length, continuation.length, this.clientId);
|
|
91
|
+
|
|
92
|
+
await Promise.all(suspendTasks);
|
|
93
|
+
return this.consumeIteratively(pq, continuation, 0);
|
|
94
|
+
}
|
|
95
|
+
return this.consumeIteratively(pq, messageViews, nextIndex);
|
|
96
|
+
})
|
|
97
|
+
.catch(err => {
|
|
98
|
+
this.#logger.error('[Bug] Exception raised in lite FIFO consumption callback, clientId=%s, error=%s',
|
|
99
|
+
this.clientId, err);
|
|
100
|
+
return this.consumeIteratively(pq, messageViews, nextIndex);
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
}
|
|
@@ -91,6 +91,10 @@ export interface LitePushConsumerOptions extends BaseClientOptions {
|
|
|
91
91
|
consumerGroup: string;
|
|
92
92
|
bindTopic: string;
|
|
93
93
|
messageListener: MessageListener;
|
|
94
|
+
maxCacheMessageCount?: number;
|
|
95
|
+
maxCacheMessageSizeInBytes?: number;
|
|
96
|
+
consumptionThreadCount?: number;
|
|
97
|
+
enableFifoConsumeAccelerator?: boolean;
|
|
94
98
|
}
|
|
95
99
|
|
|
96
100
|
const CONSUMER_GROUP_PATTERN = /^[a-zA-Z0-9_-]+$/;
|
|
@@ -178,7 +182,7 @@ export class LitePushConsumerBuilder {
|
|
|
178
182
|
if (maxCacheMessageCount <= 0) {
|
|
179
183
|
throw new Error('maxCacheMessageCount should be positive');
|
|
180
184
|
}
|
|
181
|
-
|
|
185
|
+
this.options.maxCacheMessageCount = maxCacheMessageCount;
|
|
182
186
|
return this;
|
|
183
187
|
}
|
|
184
188
|
|
|
@@ -193,7 +197,7 @@ export class LitePushConsumerBuilder {
|
|
|
193
197
|
if (maxCacheMessageSizeInBytes <= 0) {
|
|
194
198
|
throw new Error('maxCacheMessageSizeInBytes should be positive');
|
|
195
199
|
}
|
|
196
|
-
|
|
200
|
+
this.options.maxCacheMessageSizeInBytes = maxCacheMessageSizeInBytes;
|
|
197
201
|
return this;
|
|
198
202
|
}
|
|
199
203
|
|
|
@@ -208,7 +212,25 @@ export class LitePushConsumerBuilder {
|
|
|
208
212
|
if (consumptionThreadCount <= 0) {
|
|
209
213
|
throw new Error('consumptionThreadCount should be positive');
|
|
210
214
|
}
|
|
211
|
-
//
|
|
215
|
+
// Note: Node.js uses a single-threaded event loop model, so this configuration
|
|
216
|
+
// has no effect on actual consumption concurrency. It is retained solely for
|
|
217
|
+
// API compatibility with the other clients. Consumption concurrency in Node.js
|
|
218
|
+
// is naturally managed by the event loop and Promise-based async scheduling.
|
|
219
|
+
this.options.consumptionThreadCount = consumptionThreadCount;
|
|
220
|
+
return this;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
/**
|
|
224
|
+
* Set enable fifo consume accelerator.
|
|
225
|
+
*
|
|
226
|
+
* <p>If enabled, messages with different messageGroups are consumed in parallel
|
|
227
|
+
* while messages within the same messageGroup are consumed sequentially.</p>
|
|
228
|
+
*
|
|
229
|
+
* @param enableFifoConsumeAccelerator - Whether to enable FIFO consume accelerator
|
|
230
|
+
* @return This builder instance
|
|
231
|
+
*/
|
|
232
|
+
setEnableFifoConsumeAccelerator(enableFifoConsumeAccelerator: boolean): LitePushConsumerBuilder {
|
|
233
|
+
this.options.enableFifoConsumeAccelerator = enableFifoConsumeAccelerator;
|
|
212
234
|
return this;
|
|
213
235
|
}
|
|
214
236
|
|
|
@@ -247,6 +269,10 @@ export class LitePushConsumerBuilder {
|
|
|
247
269
|
sessionCredentials: this.options.sessionCredentials,
|
|
248
270
|
requestTimeout: this.options.requestTimeout,
|
|
249
271
|
logger: this.options.logger,
|
|
272
|
+
maxCacheMessageCount: this.options.maxCacheMessageCount,
|
|
273
|
+
maxCacheMessageSizeInBytes: this.options.maxCacheMessageSizeInBytes,
|
|
274
|
+
consumptionThreadCount: this.options.consumptionThreadCount,
|
|
275
|
+
enableFifoConsumeAccelerator: this.options.enableFifoConsumeAccelerator,
|
|
250
276
|
};
|
|
251
277
|
|
|
252
278
|
const litePushConsumer = new LitePushConsumerImpl(options);
|
|
@@ -24,6 +24,10 @@ import { LitePushConsumer } from './LitePushConsumer';
|
|
|
24
24
|
import { OffsetOption } from './OffsetOption';
|
|
25
25
|
import { LiteSubscriptionManager } from './LiteSubscriptionManager';
|
|
26
26
|
import { FilterExpression } from './FilterExpression';
|
|
27
|
+
import { LiteFifoConsumeService } from './LiteFifoConsumeService';
|
|
28
|
+
import { LiteStandardConsumeService } from './LiteStandardConsumeService';
|
|
29
|
+
import { ConsumeService } from './ConsumeService';
|
|
30
|
+
import { MessageListener } from './MessageListener';
|
|
27
31
|
|
|
28
32
|
export interface LitePushConsumerOptions extends PushConsumerOptions {
|
|
29
33
|
bindTopic: string;
|
|
@@ -50,6 +54,8 @@ export interface LitePushConsumerOptions extends PushConsumerOptions {
|
|
|
50
54
|
export class LitePushConsumerImpl extends PushConsumer implements LitePushConsumer {
|
|
51
55
|
private readonly liteSubscriptionManager: LiteSubscriptionManager;
|
|
52
56
|
private readonly bindTopic: Resource;
|
|
57
|
+
readonly #messageListener: MessageListener;
|
|
58
|
+
readonly #enableFifoConsumeAccelerator: boolean;
|
|
53
59
|
|
|
54
60
|
constructor(options: LitePushConsumerOptions) {
|
|
55
61
|
// Create subscription expressions with bind topic
|
|
@@ -61,6 +67,9 @@ export class LitePushConsumerImpl extends PushConsumer implements LitePushConsum
|
|
|
61
67
|
subscriptions,
|
|
62
68
|
} as PushConsumerOptions);
|
|
63
69
|
|
|
70
|
+
this.#messageListener = options.messageListener;
|
|
71
|
+
this.#enableFifoConsumeAccelerator = options.enableFifoConsumeAccelerator ?? false;
|
|
72
|
+
|
|
64
73
|
this.bindTopic = new Resource(options.namespace, options.bindTopic);
|
|
65
74
|
|
|
66
75
|
const groupResource = new Resource(options.namespace, options.consumerGroup);
|
|
@@ -71,6 +80,27 @@ export class LitePushConsumerImpl extends PushConsumer implements LitePushConsum
|
|
|
71
80
|
);
|
|
72
81
|
}
|
|
73
82
|
|
|
83
|
+
/**
|
|
84
|
+
* Create the consume service for lite push consumer.
|
|
85
|
+
*
|
|
86
|
+
* <p>Lite push consumer uses lite-topic-specific consume services to ensure
|
|
87
|
+
* correct grouping and retry behavior.</p>
|
|
88
|
+
*/
|
|
89
|
+
protected createConsumeService(): ConsumeService {
|
|
90
|
+
if (!this.#messageListener) {
|
|
91
|
+
throw new Error('messageListener should not be null');
|
|
92
|
+
}
|
|
93
|
+
if (this.getPushConsumerSettings().isFifo()) {
|
|
94
|
+
this.logger.info(
|
|
95
|
+
'Create lite FIFO consume service, consumerGroup=%s, clientId=%s, enableFifoConsumeAccelerator=%s',
|
|
96
|
+
this.consumerGroup, this.clientId, this.#enableFifoConsumeAccelerator,
|
|
97
|
+
);
|
|
98
|
+
return new LiteFifoConsumeService(this.clientId, this.#messageListener, this.#enableFifoConsumeAccelerator);
|
|
99
|
+
}
|
|
100
|
+
this.logger.info('Create lite standard consume service, consumerGroup=%s, clientId=%s', this.consumerGroup, this.clientId);
|
|
101
|
+
return new LiteStandardConsumeService(this.clientId, this.#messageListener);
|
|
102
|
+
}
|
|
103
|
+
|
|
74
104
|
/**
|
|
75
105
|
* Get the client type.
|
|
76
106
|
*
|
|
@@ -137,6 +167,9 @@ export class LitePushConsumerImpl extends PushConsumer implements LitePushConsum
|
|
|
137
167
|
async subscribeLite(liteTopic: string, offsetOption: OffsetOption): Promise<void>;
|
|
138
168
|
|
|
139
169
|
async subscribeLite(liteTopic: string, offsetOption?: OffsetOption): Promise<void> {
|
|
170
|
+
if (!liteTopic || liteTopic.trim().length === 0) {
|
|
171
|
+
throw new Error('liteTopic should not be blank');
|
|
172
|
+
}
|
|
140
173
|
await this.liteSubscriptionManager.subscribeLite(liteTopic, offsetOption ?? null);
|
|
141
174
|
}
|
|
142
175
|
|
|
@@ -149,6 +182,9 @@ export class LitePushConsumerImpl extends PushConsumer implements LitePushConsum
|
|
|
149
182
|
* @param liteTopic - The name of the lite topic to unsubscribe from
|
|
150
183
|
*/
|
|
151
184
|
async unsubscribeLite(liteTopic: string): Promise<void> {
|
|
185
|
+
if (!liteTopic || liteTopic.trim().length === 0) {
|
|
186
|
+
throw new Error('liteTopic should not be blank');
|
|
187
|
+
}
|
|
152
188
|
await this.liteSubscriptionManager.unsubscribeLite(liteTopic);
|
|
153
189
|
}
|
|
154
190
|
|
|
@@ -0,0 +1,73 @@
|
|
|
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
|
+
import { MessageView } from '../message';
|
|
19
|
+
import { ConsumeService } from './ConsumeService';
|
|
20
|
+
import { MessageListener } from './MessageListener';
|
|
21
|
+
import type { ProcessQueue } from './ProcessQueue';
|
|
22
|
+
import { ILogger, getDefaultLogger } from '../client/Logger';
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Standard consume service for lite push consumer.
|
|
26
|
+
*
|
|
27
|
+
* <p>Similar to {@link StandardConsumeService}, but uses
|
|
28
|
+
* {@link ProcessQueue#eraseFifoMessage} for local retry on failure, avoiding
|
|
29
|
+
* frequent server requests.</p>
|
|
30
|
+
*/
|
|
31
|
+
export class LiteStandardConsumeService extends ConsumeService {
|
|
32
|
+
readonly #logger: ILogger;
|
|
33
|
+
|
|
34
|
+
constructor(clientId: string, messageListener: MessageListener) {
|
|
35
|
+
super(clientId, messageListener);
|
|
36
|
+
this.#logger = getDefaultLogger();
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
consume(pq: ProcessQueue, messageViews: MessageView[]): void {
|
|
40
|
+
if (!pq || !messageViews) {
|
|
41
|
+
this.#logger.error('[Bug] Invalid arguments for consume, pq=%s, messageViews=%s, clientId=%s', pq, messageViews, this.clientId);
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
this.#logger.debug?.('LiteStandardConsumeService.consume called, messageCount=%d, clientId=%s', messageViews.length, this.clientId);
|
|
46
|
+
|
|
47
|
+
for (const messageView of messageViews) {
|
|
48
|
+
if (messageView.corrupted) {
|
|
49
|
+
this.#logger.error('Message is corrupted for lite standard consumption, prepare to discard it, mq=%s, '
|
|
50
|
+
+ 'messageId=%s, clientId=%s',
|
|
51
|
+
pq.getMessageQueue(), messageView.messageId, this.clientId);
|
|
52
|
+
pq.discardMessage(messageView);
|
|
53
|
+
continue;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
this.#logger.debug?.('Consuming lite message, messageId=%s, topic=%s, liteTopic=%s, clientId=%s',
|
|
57
|
+
messageView.messageId, messageView.topic, messageView.liteTopic, this.clientId);
|
|
58
|
+
|
|
59
|
+
this.consumeMessage(messageView)
|
|
60
|
+
.then(result => {
|
|
61
|
+
this.#logger.debug?.('Lite message consumed successfully, messageId=%s, result=%s, clientId=%s',
|
|
62
|
+
messageView.messageId, result, this.clientId);
|
|
63
|
+
// Use eraseFifoMessage for local retry on failure, avoiding frequent server requests.
|
|
64
|
+
pq.eraseFifoMessage(messageView, result);
|
|
65
|
+
})
|
|
66
|
+
.catch(err => {
|
|
67
|
+
// Should never reach here.
|
|
68
|
+
this.#logger.error('[Bug] Exception raised in lite standard consumption callback, clientId=%s, error=%s',
|
|
69
|
+
this.clientId, err);
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
@@ -62,6 +62,8 @@ export class LiteSubscriptionManager {
|
|
|
62
62
|
* Start periodic sync of lite subscriptions.
|
|
63
63
|
*/
|
|
64
64
|
public startUp() {
|
|
65
|
+
// syncAll after startup for subscribeLite("*")
|
|
66
|
+
this.syncAllLiteSubscription();
|
|
65
67
|
this.syncTimer = setInterval(
|
|
66
68
|
() => this.syncAllLiteSubscription(),
|
|
67
69
|
SYNC_LITE_SUBSCRIPTION_INTERVAL,
|