rocketmq-client-remoting-nodejs 0.0.0-stage → 0.0.1
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/README.en.md +428 -0
- package/README.md +424 -2
- package/dist/client/admin.d.ts +229 -0
- package/dist/client/admin.js +2462 -0
- package/dist/client/allocate.d.ts +48 -0
- package/dist/client/allocate.js +365 -0
- package/dist/client/backpressure.d.ts +23 -0
- package/dist/client/backpressure.js +95 -0
- package/dist/client/consumer.d.ts +294 -0
- package/dist/client/consumer.js +3095 -0
- package/dist/client/consumer_result.d.ts +129 -0
- package/dist/client/consumer_result.js +138 -0
- package/dist/client/consumer_stats.d.ts +69 -0
- package/dist/client/consumer_stats.js +258 -0
- package/dist/client/exception.d.ts +39 -0
- package/dist/client/exception.js +36 -0
- package/dist/client/hook.d.ts +145 -0
- package/dist/client/hook.js +171 -0
- package/dist/client/latency.d.ts +61 -0
- package/dist/client/latency.js +239 -0
- package/dist/client/lite_pull_consumer.d.ts +151 -0
- package/dist/client/lite_pull_consumer.js +1096 -0
- package/dist/client/mq_client.d.ts +188 -0
- package/dist/client/mq_client.js +1678 -0
- package/dist/client/mq_client_manager.d.ts +21 -0
- package/dist/client/mq_client_manager.js +129 -0
- package/dist/client/offset_store.d.ts +45 -0
- package/dist/client/offset_store.js +389 -0
- package/dist/client/open_tracing_hook.d.ts +52 -0
- package/dist/client/open_tracing_hook.js +241 -0
- package/dist/client/pop_api.d.ts +28 -0
- package/dist/client/pop_api.js +224 -0
- package/dist/client/pop_consumer.d.ts +23 -0
- package/dist/client/pop_consumer.js +719 -0
- package/dist/client/pop_process_queue.d.ts +15 -0
- package/dist/client/pop_process_queue.js +51 -0
- package/dist/client/process_queue.d.ts +49 -0
- package/dist/client/process_queue.js +261 -0
- package/dist/client/produce_accumulator.d.ts +75 -0
- package/dist/client/produce_accumulator.js +288 -0
- package/dist/client/producer.d.ts +231 -0
- package/dist/client/producer.js +1774 -0
- package/dist/client/pull_api.d.ts +26 -0
- package/dist/client/pull_api.js +264 -0
- package/dist/client/pull_consumer.d.ts +119 -0
- package/dist/client/pull_consumer.js +876 -0
- package/dist/client/pull_schedule_service.d.ts +71 -0
- package/dist/client/pull_schedule_service.js +424 -0
- package/dist/client/request_reply.d.ts +61 -0
- package/dist/client/request_reply.js +232 -0
- package/dist/client/retry_message.d.ts +2 -0
- package/dist/client/retry_message.js +27 -0
- package/dist/client/send_result.d.ts +57 -0
- package/dist/client/send_result.js +70 -0
- package/dist/client/top_addressing.d.ts +20 -0
- package/dist/client/top_addressing.js +75 -0
- package/dist/client/trace_context.d.ts +61 -0
- package/dist/client/trace_context.js +373 -0
- package/dist/client/trace_dispatcher.d.ts +31 -0
- package/dist/client/trace_dispatcher.js +236 -0
- package/dist/client/trace_hook.d.ts +23 -0
- package/dist/client/trace_hook.js +228 -0
- package/dist/client/traceparent.d.ts +9 -0
- package/dist/client/traceparent.js +86 -0
- package/dist/common/boundary_type.d.ts +7 -0
- package/dist/common/boundary_type.js +16 -0
- package/dist/common/compress.d.ts +28 -0
- package/dist/common/compress.js +512 -0
- package/dist/common/message.d.ts +129 -0
- package/dist/common/message.js +214 -0
- package/dist/common/messageClientIdSetter.d.ts +7 -0
- package/dist/common/messageClientIdSetter.js +48 -0
- package/dist/common/messageConst.d.ts +68 -0
- package/dist/common/messageConst.js +68 -0
- package/dist/common/messageDecoder.d.ts +40 -0
- package/dist/common/messageDecoder.js +504 -0
- package/dist/common/messageType.d.ts +11 -0
- package/dist/common/messageType.js +11 -0
- package/dist/common/message_accessor.d.ts +39 -0
- package/dist/common/message_accessor.js +135 -0
- package/dist/common/mixAll.d.ts +106 -0
- package/dist/common/mixAll.js +247 -0
- package/dist/common/recall_message_handle.d.ts +25 -0
- package/dist/common/recall_message_handle.js +98 -0
- package/dist/common/subscriptionData.d.ts +36 -0
- package/dist/common/subscriptionData.js +64 -0
- package/dist/common/sysflag.d.ts +129 -0
- package/dist/common/sysflag.js +96 -0
- package/dist/common/topic_config.d.ts +66 -0
- package/dist/common/topic_config.js +106 -0
- package/dist/common/topic_validator.d.ts +49 -0
- package/dist/common/topic_validator.js +115 -0
- package/dist/common/utilAll.d.ts +39 -0
- package/dist/common/utilAll.js +154 -0
- package/dist/common/validators.d.ts +25 -0
- package/dist/common/validators.js +80 -0
- package/dist/index.d.ts +24 -0
- package/dist/index.js +36 -0
- package/dist/logging.d.ts +24 -0
- package/dist/logging.js +246 -0
- package/dist/remoting/acl.d.ts +16 -0
- package/dist/remoting/acl.js +39 -0
- package/dist/remoting/admin_body.d.ts +257 -0
- package/dist/remoting/admin_body.js +669 -0
- package/dist/remoting/bodies.d.ts +475 -0
- package/dist/remoting/bodies.js +1131 -0
- package/dist/remoting/client.d.ts +73 -0
- package/dist/remoting/client.js +591 -0
- package/dist/remoting/codes.d.ts +296 -0
- package/dist/remoting/codes.js +301 -0
- package/dist/remoting/exception.d.ts +45 -0
- package/dist/remoting/exception.js +58 -0
- package/dist/remoting/extra_info.d.ts +61 -0
- package/dist/remoting/extra_info.js +220 -0
- package/dist/remoting/headers.d.ts +758 -0
- package/dist/remoting/headers.js +1307 -0
- package/dist/remoting/heartbeat.d.ts +91 -0
- package/dist/remoting/heartbeat.js +227 -0
- package/dist/remoting/namespace.d.ts +14 -0
- package/dist/remoting/namespace.js +85 -0
- package/dist/remoting/pop_bodies.d.ts +58 -0
- package/dist/remoting/pop_bodies.js +214 -0
- package/dist/remoting/remotingCommand.d.ts +39 -0
- package/dist/remoting/remotingCommand.js +225 -0
- package/dist/remoting/route.d.ts +61 -0
- package/dist/remoting/route.js +288 -0
- package/dist/remoting/rpc_hooks.d.ts +31 -0
- package/dist/remoting/rpc_hooks.js +73 -0
- package/dist/remoting/serialize.d.ts +33 -0
- package/dist/remoting/serialize.js +372 -0
- package/dist/remoting/socks_proxy.d.ts +29 -0
- package/dist/remoting/socks_proxy.js +379 -0
- package/dist/remoting/static_topic.d.ts +49 -0
- package/dist/remoting/static_topic.js +244 -0
- package/dist/remoting/subscription.d.ts +65 -0
- package/dist/remoting/subscription.js +172 -0
- package/package.json +38 -4
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
export declare const KEY_SEPARATOR = " ";
|
|
2
|
+
export declare const QUEUE_SEPARATOR = ";";
|
|
3
|
+
export declare const OFFSET_SEPARATOR = ",";
|
|
4
|
+
export declare const NORMAL_TOPIC = "0";
|
|
5
|
+
export declare const RETRY_TOPIC = "1";
|
|
6
|
+
export declare const RETRY_TOPIC_V2 = "2";
|
|
7
|
+
export declare const QUEUE_OFFSET = "qo";
|
|
8
|
+
export declare const POP_ORDER_REVIVE_QUEUE = 999;
|
|
9
|
+
export declare function buildPopRetryTopicV1(topic: string, cid: string): string;
|
|
10
|
+
export declare function buildPopRetryTopicV2(topic: string, cid: string): string;
|
|
11
|
+
export declare function buildPopRetryTopic(topic: string, cid: string, enableRetryV2?: boolean): string;
|
|
12
|
+
export declare function isPopRetryTopicV2(retryTopic: string | null | undefined): boolean;
|
|
13
|
+
export declare function split(extraInfo: string | null | undefined): string[];
|
|
14
|
+
export declare function getCkQueueOffset(segments: string[] | null | undefined): number;
|
|
15
|
+
export declare function getPopTime(segments: string[] | null | undefined): number;
|
|
16
|
+
export declare function getInvisibleTime(segments: string[] | null | undefined): number;
|
|
17
|
+
export declare function getReviveQid(segments: string[] | null | undefined): number;
|
|
18
|
+
export declare function getRetry(segments: string[] | null | undefined): string;
|
|
19
|
+
export declare function getBrokerName(segments: string[] | null | undefined): string;
|
|
20
|
+
export declare function getQueueId(segments: string[] | null | undefined): number;
|
|
21
|
+
export declare function getQueueOffset(segments: string[] | null | undefined): number;
|
|
22
|
+
export declare function retryOfTopic(topic: string): string;
|
|
23
|
+
export declare function buildExtraInfo(ckQueueOffset: number, popTime: number, invisibleTime: number, reviveQid: number, topic: string, brokerName: string, queueId: number, msgQueueOffset?: number | null): string;
|
|
24
|
+
export declare function parseStartOffsetInfo(startOffsetInfo: string | null | undefined): Record<string, number> | null;
|
|
25
|
+
export declare function parseMsgOffsetInfo(msgOffsetInfo: string | null | undefined): Record<string, number[]> | null;
|
|
26
|
+
export declare function parseOrderCountInfo(orderCountInfo: string | null | undefined): Record<string, number> | null;
|
|
27
|
+
export declare function getStartOffsetInfoMapKey(topic: string, key: any): string;
|
|
28
|
+
export declare function getQueueOffsetKeyValueKey(queueId: any, queueOffset: any): string;
|
|
29
|
+
export declare function getQueueOffsetMapKey(topic: string, queueId: any, queueOffset: any): string;
|
|
30
|
+
export declare function isOrder(segments: string[]): boolean;
|
|
31
|
+
export declare function getRealTopic(topic: string, cid: string, retry: string): string;
|
|
32
|
+
export declare class ExtraInfoUtil {
|
|
33
|
+
static split: typeof split;
|
|
34
|
+
static getCkQueueOffset: typeof getCkQueueOffset;
|
|
35
|
+
static getPopTime: typeof getPopTime;
|
|
36
|
+
static getInvisibleTime: typeof getInvisibleTime;
|
|
37
|
+
static getReviveQid: typeof getReviveQid;
|
|
38
|
+
static getRetry: typeof getRetry;
|
|
39
|
+
static getBrokerName: typeof getBrokerName;
|
|
40
|
+
static getQueueId: typeof getQueueId;
|
|
41
|
+
static getQueueOffset: typeof getQueueOffset;
|
|
42
|
+
static retryOfTopic: typeof retryOfTopic;
|
|
43
|
+
static buildExtraInfo: typeof buildExtraInfo;
|
|
44
|
+
static parseStartOffsetInfo: typeof parseStartOffsetInfo;
|
|
45
|
+
static parseMsgOffsetInfo: typeof parseMsgOffsetInfo;
|
|
46
|
+
static parseOrderCountInfo: typeof parseOrderCountInfo;
|
|
47
|
+
static getStartOffsetInfoMapKey: typeof getStartOffsetInfoMapKey;
|
|
48
|
+
static getQueueOffsetKeyValueKey: typeof getQueueOffsetKeyValueKey;
|
|
49
|
+
static getQueueOffsetMapKey: typeof getQueueOffsetMapKey;
|
|
50
|
+
static isOrder: typeof isOrder;
|
|
51
|
+
static getRealTopic: typeof getRealTopic;
|
|
52
|
+
static parseBname(extraInfo: string): string;
|
|
53
|
+
static parseTopic(extraInfo: string): string;
|
|
54
|
+
static parseOrigTopic(retry: string, topic: string, cid: string): string;
|
|
55
|
+
static parseQueueId(extraInfo: string): number;
|
|
56
|
+
static parseQueueOffset(extraInfo: string): number;
|
|
57
|
+
static parseOffset(extraInfo: string, _q?: any): number;
|
|
58
|
+
static parsePopTime(extraInfo: string): number;
|
|
59
|
+
static parseInvisibleTime(extraInfo: string): number;
|
|
60
|
+
}
|
|
61
|
+
export default ExtraInfoUtil;
|
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
// The CK string is the core credential of POP mode: the broker does NOT write the
|
|
2
|
+
// POP_CK property for ordinary-topic messages (only on the retry-topic re-encode
|
|
3
|
+
// path), so the client must reconstruct this string from the response header's
|
|
4
|
+
// startOffsetInfo / msgOffsetInfo and then hand it back as the `extraInfo` of
|
|
5
|
+
// ACK / CHANGE_MESSAGE_INVISIBLETIME. The format is 7 or 8 SPACE-separated
|
|
6
|
+
// segments:
|
|
7
|
+
// ckQueueOffset popTime invisibleTime reviveQid retryFlag brokerName queueId [msgQueueOffset]
|
|
8
|
+
// NOTE: the segment separator is a SPACE, not a comma - using the wrong separator
|
|
9
|
+
// makes the broker silently fail to parse.
|
|
10
|
+
import { MixAll } from "../common/mixAll.js";
|
|
11
|
+
export const KEY_SEPARATOR = ' ';
|
|
12
|
+
export const QUEUE_SEPARATOR = ';';
|
|
13
|
+
export const OFFSET_SEPARATOR = ',';
|
|
14
|
+
export const NORMAL_TOPIC = '0';
|
|
15
|
+
export const RETRY_TOPIC = '1';
|
|
16
|
+
export const RETRY_TOPIC_V2 = '2';
|
|
17
|
+
export const QUEUE_OFFSET = 'qo';
|
|
18
|
+
// The revive queue index fixed for use by ordered consumption.
|
|
19
|
+
export const POP_ORDER_REVIVE_QUEUE = 999;
|
|
20
|
+
const _POP_RETRY_SEPARATOR_V1 = '_';
|
|
21
|
+
const _POP_RETRY_SEPARATOR_V2 = '+';
|
|
22
|
+
export function buildPopRetryTopicV1(topic, cid) {
|
|
23
|
+
return MixAll.RETRY_GROUP_TOPIC_PREFIX + cid + _POP_RETRY_SEPARATOR_V1 + topic;
|
|
24
|
+
}
|
|
25
|
+
export function buildPopRetryTopicV2(topic, cid) {
|
|
26
|
+
return MixAll.RETRY_GROUP_TOPIC_PREFIX + cid + _POP_RETRY_SEPARATOR_V2 + topic;
|
|
27
|
+
}
|
|
28
|
+
export function buildPopRetryTopic(topic, cid, enableRetryV2 = false) {
|
|
29
|
+
return enableRetryV2 ? buildPopRetryTopicV2(topic, cid) : buildPopRetryTopicV1(topic, cid);
|
|
30
|
+
}
|
|
31
|
+
export function isPopRetryTopicV2(retryTopic) {
|
|
32
|
+
if (!retryTopic)
|
|
33
|
+
return false;
|
|
34
|
+
return retryTopic.startsWith(MixAll.RETRY_GROUP_TOPIC_PREFIX) && retryTopic.includes(_POP_RETRY_SEPARATOR_V2);
|
|
35
|
+
}
|
|
36
|
+
// Split by delimiter and discard trailing empty segments (the ck string is space-separated; the last segment may be empty).
|
|
37
|
+
function _splitDropTrailing(value, sep) {
|
|
38
|
+
const parts = value.split(sep);
|
|
39
|
+
while (parts.length && parts[parts.length - 1] === '')
|
|
40
|
+
parts.pop();
|
|
41
|
+
return parts;
|
|
42
|
+
}
|
|
43
|
+
export function split(extraInfo) {
|
|
44
|
+
if (extraInfo == null)
|
|
45
|
+
throw new Error('split extraInfo is null');
|
|
46
|
+
return _splitDropTrailing(extraInfo, KEY_SEPARATOR);
|
|
47
|
+
}
|
|
48
|
+
function _require(segments, need, what) {
|
|
49
|
+
if (segments == null || segments.length < need) {
|
|
50
|
+
throw new Error(`${what} fail, extraInfoStrs length ${segments == null ? 0 : segments.length}`);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
export function getCkQueueOffset(segments) {
|
|
54
|
+
_require(segments, 1, 'getCkQueueOffset');
|
|
55
|
+
return parseInt(segments[0], 10);
|
|
56
|
+
}
|
|
57
|
+
export function getPopTime(segments) {
|
|
58
|
+
_require(segments, 2, 'getPopTime');
|
|
59
|
+
return parseInt(segments[1], 10);
|
|
60
|
+
}
|
|
61
|
+
export function getInvisibleTime(segments) {
|
|
62
|
+
_require(segments, 3, 'getInvisibleTime');
|
|
63
|
+
return parseInt(segments[2], 10);
|
|
64
|
+
}
|
|
65
|
+
export function getReviveQid(segments) {
|
|
66
|
+
_require(segments, 4, 'getReviveQid');
|
|
67
|
+
return parseInt(segments[3], 10);
|
|
68
|
+
}
|
|
69
|
+
export function getRetry(segments) {
|
|
70
|
+
_require(segments, 5, 'getRetry');
|
|
71
|
+
return segments[4];
|
|
72
|
+
}
|
|
73
|
+
export function getBrokerName(segments) {
|
|
74
|
+
_require(segments, 6, 'getBrokerName');
|
|
75
|
+
return segments[5];
|
|
76
|
+
}
|
|
77
|
+
export function getQueueId(segments) {
|
|
78
|
+
_require(segments, 7, 'getQueueId');
|
|
79
|
+
return parseInt(segments[6], 10);
|
|
80
|
+
}
|
|
81
|
+
export function getQueueOffset(segments) {
|
|
82
|
+
_require(segments, 8, 'getQueueOffset');
|
|
83
|
+
return parseInt(segments[7], 10);
|
|
84
|
+
}
|
|
85
|
+
export function retryOfTopic(topic) {
|
|
86
|
+
if (isPopRetryTopicV2(topic))
|
|
87
|
+
return RETRY_TOPIC_V2;
|
|
88
|
+
if (topic.startsWith(MixAll.RETRY_GROUP_TOPIC_PREFIX))
|
|
89
|
+
return RETRY_TOPIC;
|
|
90
|
+
return NORMAL_TOPIC;
|
|
91
|
+
}
|
|
92
|
+
// Build the CK string. Pass msgQueueOffset to get 8 segments; omit for 7 segments.
|
|
93
|
+
// ACK uses the 8-field form.
|
|
94
|
+
export function buildExtraInfo(ckQueueOffset, popTime, invisibleTime, reviveQid, topic, brokerName, queueId, msgQueueOffset) {
|
|
95
|
+
const parts = [
|
|
96
|
+
String(ckQueueOffset),
|
|
97
|
+
String(popTime),
|
|
98
|
+
String(invisibleTime),
|
|
99
|
+
String(reviveQid),
|
|
100
|
+
retryOfTopic(topic),
|
|
101
|
+
String(brokerName),
|
|
102
|
+
String(queueId),
|
|
103
|
+
];
|
|
104
|
+
if (msgQueueOffset != null)
|
|
105
|
+
parts.push(String(msgQueueOffset));
|
|
106
|
+
return parts.join(KEY_SEPARATOR);
|
|
107
|
+
}
|
|
108
|
+
export function parseStartOffsetInfo(startOffsetInfo) {
|
|
109
|
+
if (!startOffsetInfo)
|
|
110
|
+
return null;
|
|
111
|
+
const out = {};
|
|
112
|
+
const segments = (startOffsetInfo.includes(QUEUE_SEPARATOR)
|
|
113
|
+
? _splitDropTrailing(startOffsetInfo, QUEUE_SEPARATOR)
|
|
114
|
+
: [startOffsetInfo]);
|
|
115
|
+
for (const one of segments) {
|
|
116
|
+
const parts = one.split(KEY_SEPARATOR);
|
|
117
|
+
if (parts.length !== 3)
|
|
118
|
+
throw new Error('parse startOffsetInfo error, ' + startOffsetInfo);
|
|
119
|
+
const key = parts[0] + '@' + parts[1];
|
|
120
|
+
if (key in out)
|
|
121
|
+
throw new Error('parse startOffsetInfo error, duplicate, ' + startOffsetInfo);
|
|
122
|
+
out[key] = parseInt(parts[2], 10);
|
|
123
|
+
}
|
|
124
|
+
return out;
|
|
125
|
+
}
|
|
126
|
+
export function parseMsgOffsetInfo(msgOffsetInfo) {
|
|
127
|
+
if (!msgOffsetInfo)
|
|
128
|
+
return null;
|
|
129
|
+
const out = {};
|
|
130
|
+
const segments = (msgOffsetInfo.includes(QUEUE_SEPARATOR)
|
|
131
|
+
? _splitDropTrailing(msgOffsetInfo, QUEUE_SEPARATOR)
|
|
132
|
+
: [msgOffsetInfo]);
|
|
133
|
+
for (const one of segments) {
|
|
134
|
+
const parts = one.split(KEY_SEPARATOR);
|
|
135
|
+
if (parts.length !== 3)
|
|
136
|
+
throw new Error('parse msgOffsetInfo error, ' + msgOffsetInfo);
|
|
137
|
+
const key = parts[0] + '@' + parts[1];
|
|
138
|
+
if (key in out)
|
|
139
|
+
throw new Error('parse msgOffsetInfo error, duplicate, ' + msgOffsetInfo);
|
|
140
|
+
out[key] = _splitDropTrailing(parts[2], OFFSET_SEPARATOR).map((x) => parseInt(x, 10));
|
|
141
|
+
}
|
|
142
|
+
return out;
|
|
143
|
+
}
|
|
144
|
+
export function parseOrderCountInfo(orderCountInfo) {
|
|
145
|
+
if (!orderCountInfo)
|
|
146
|
+
return null;
|
|
147
|
+
const out = {};
|
|
148
|
+
const segments = (orderCountInfo.includes(QUEUE_SEPARATOR)
|
|
149
|
+
? _splitDropTrailing(orderCountInfo, QUEUE_SEPARATOR)
|
|
150
|
+
: [orderCountInfo]);
|
|
151
|
+
for (const one of segments) {
|
|
152
|
+
const parts = one.split(KEY_SEPARATOR);
|
|
153
|
+
if (parts.length !== 3)
|
|
154
|
+
throw new Error('parse orderCountInfo error, ' + orderCountInfo);
|
|
155
|
+
const key = parts[0] + '@' + parts[1];
|
|
156
|
+
if (key in out)
|
|
157
|
+
throw new Error('parse orderCountInfo error, duplicate, ' + orderCountInfo);
|
|
158
|
+
out[key] = parseInt(parts[2], 10);
|
|
159
|
+
}
|
|
160
|
+
return out;
|
|
161
|
+
}
|
|
162
|
+
export function getStartOffsetInfoMapKey(topic, key) {
|
|
163
|
+
return retryOfTopic(topic) + '@' + String(key);
|
|
164
|
+
}
|
|
165
|
+
export function getQueueOffsetKeyValueKey(queueId, queueOffset) {
|
|
166
|
+
return QUEUE_OFFSET + String(queueId) + '%' + String(queueOffset);
|
|
167
|
+
}
|
|
168
|
+
export function getQueueOffsetMapKey(topic, queueId, queueOffset) {
|
|
169
|
+
return retryOfTopic(topic) + '@' + getQueueOffsetKeyValueKey(queueId, queueOffset);
|
|
170
|
+
}
|
|
171
|
+
export function isOrder(segments) {
|
|
172
|
+
return getReviveQid(segments) === POP_ORDER_REVIVE_QUEUE;
|
|
173
|
+
}
|
|
174
|
+
export function getRealTopic(topic, cid, retry) {
|
|
175
|
+
if (retry === NORMAL_TOPIC)
|
|
176
|
+
return topic;
|
|
177
|
+
if (retry === RETRY_TOPIC)
|
|
178
|
+
return buildPopRetryTopicV1(topic, cid);
|
|
179
|
+
if (retry === RETRY_TOPIC_V2)
|
|
180
|
+
return buildPopRetryTopicV2(topic, cid);
|
|
181
|
+
throw new Error('getRetry fail, format is wrong');
|
|
182
|
+
}
|
|
183
|
+
// ---------------------------------------------------------------------------
|
|
184
|
+
// Convenience wrappers matching the client-layer names (parse*). These simply
|
|
185
|
+
// split the CK string and delegate to the get* accessors above.
|
|
186
|
+
// ---------------------------------------------------------------------------
|
|
187
|
+
export class ExtraInfoUtil {
|
|
188
|
+
static split = split;
|
|
189
|
+
static getCkQueueOffset = getCkQueueOffset;
|
|
190
|
+
static getPopTime = getPopTime;
|
|
191
|
+
static getInvisibleTime = getInvisibleTime;
|
|
192
|
+
static getReviveQid = getReviveQid;
|
|
193
|
+
static getRetry = getRetry;
|
|
194
|
+
static getBrokerName = getBrokerName;
|
|
195
|
+
static getQueueId = getQueueId;
|
|
196
|
+
static getQueueOffset = getQueueOffset;
|
|
197
|
+
static retryOfTopic = retryOfTopic;
|
|
198
|
+
static buildExtraInfo = buildExtraInfo;
|
|
199
|
+
static parseStartOffsetInfo = parseStartOffsetInfo;
|
|
200
|
+
static parseMsgOffsetInfo = parseMsgOffsetInfo;
|
|
201
|
+
static parseOrderCountInfo = parseOrderCountInfo;
|
|
202
|
+
static getStartOffsetInfoMapKey = getStartOffsetInfoMapKey;
|
|
203
|
+
static getQueueOffsetKeyValueKey = getQueueOffsetKeyValueKey;
|
|
204
|
+
static getQueueOffsetMapKey = getQueueOffsetMapKey;
|
|
205
|
+
static isOrder = isOrder;
|
|
206
|
+
static getRealTopic = getRealTopic;
|
|
207
|
+
// parseBname(extraInfo) -> broker name
|
|
208
|
+
static parseBname(extraInfo) { return getBrokerName(split(extraInfo)); }
|
|
209
|
+
// parseTopic(extraInfo) -> retry flag string ("0"/"1"/"2"); the CK carries no topic text.
|
|
210
|
+
static parseTopic(extraInfo) { return getRetry(split(extraInfo)); }
|
|
211
|
+
// parseOrigTopic(retry, topic, cid) -> the real (possibly retry) topic
|
|
212
|
+
static parseOrigTopic(retry, topic, cid) { return getRealTopic(topic, cid, retry); }
|
|
213
|
+
static parseQueueId(extraInfo) { return getQueueId(split(extraInfo)); }
|
|
214
|
+
static parseQueueOffset(extraInfo) { return getQueueOffset(split(extraInfo)); }
|
|
215
|
+
// parseOffset(extraInfo, q?) -> ack offset (= consumeQueue offset). The optional q is ignored.
|
|
216
|
+
static parseOffset(extraInfo, _q) { return getQueueOffset(split(extraInfo)); }
|
|
217
|
+
static parsePopTime(extraInfo) { return getPopTime(split(extraInfo)); }
|
|
218
|
+
static parseInvisibleTime(extraInfo) { return getInvisibleTime(split(extraInfo)); }
|
|
219
|
+
}
|
|
220
|
+
export default ExtraInfoUtil;
|