config.ts
5.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
import { FormSchema } from '/@/components/Form';
const PolicyTypeEnum = {
SEQUENTIAL_BY_ORIGINATOR: 'SEQUENTIAL_BY_ORIGINATOR',
SEQUENTIAL_BY_TENANT: 'SEQUENTIAL_BY_TENANT',
SEQUENTIAL: 'SEQUENTIAL',
BURST: 'BURST',
BATCH: 'BATCH',
};
const PolicyTypeLabelEnum = {
SEQUENTIAL_BY_ORIGINATOR: '按发起者顺序处理',
SEQUENTIAL_BY_TENANT: '按租户顺序处理',
SEQUENTIAL: '顺序处理',
BURST: '突发处理',
BATCH: '批量处理',
};
const ProcessTypeEnum = {
RETRY_FAILED_AND_TIMED_OUT: 'RETRY_FAILED_AND_TIMED_OUT',
SKIP_ALL_FAILURES: 'SKIP_ALL_FAILURES',
SKIP_ALL_FAILURES_AND_TIMED_OUT: 'SKIP_ALL_FAILURES_AND_TIMED_OUT',
RETRY_ALL: 'RETRY_ALL',
RETRY_FAILED: 'RETRY_FAILED',
RETRY_TIMED_OUT: 'RETRY_TIMED_OUT',
};
const ProcessTypeLabelEnum = {
RETRY_FAILED_AND_TIMED_OUT: '失败与超时重试',
SKIP_ALL_FAILURES: '跳过所有失败',
SKIP_ALL_FAILURES_AND_TIMED_OUT: '跳过所有失败和超时',
RETRY_ALL: '全部重试',
RETRY_FAILED: '失败重试',
RETRY_TIMED_OUT: '超时重试',
};
export const formSchema: FormSchema[] = [
{
field: 'name',
label: '名称',
component: 'Input',
required: true,
rules: [
{
pattern: /^[A-Za-z0-9._-]*$/,
message: "不能包含ASCII字母数字以外的字符, '.', '_' 和 '-'等",
},
{
required: true,
},
],
slot: 'nameSlot',
},
{
field: 'disabled',
label: '',
component: 'Checkbox',
ifShow: false,
},
{
// 用于判断名称是否是唯一的
field: 'nameOnly',
label: '',
defaultValue: true,
component: 'Checkbox',
ifShow: false,
},
{
field: 'topic',
label: '',
component: 'Input',
ifShow: false,
},
{
field: 'customProperties',
label: '自定义属性',
component: 'Input',
helpMessage: [
'自定义队列(主题)创建属性,例如:retention.ms:604800000;retention.bytes:1048576000',
],
},
{
field: 'description',
label: '说明',
component: 'InputTextArea',
helpMessage: ['此文本将显示在队列说明中,而不是所选策略中'],
},
];
export const submitStrategySchema: FormSchema[] = [
{
field: 'type',
label: '策略类型',
component: 'Select',
helpMessage: [
'按发起者顺序处理:在确认设备A的前一条消息之前,不会提交设备A的新消息',
'按租户顺序处理:在确认租户A的前一条消息之前,不会提交租户A的新消息',
'顺序处理:在确认前一条消息之前,不会提交新消息',
'突发处理:所有消息都按到达顺序提交到规则链',
'批量处理:在确认前一批消息之前,不会提交新批',
],
defaultValue: PolicyTypeEnum.BURST,
componentProps: {
options: Object.keys(PolicyTypeLabelEnum).map((item) => ({
label: PolicyTypeLabelEnum[item],
value: PolicyTypeEnum[item],
})),
},
},
{
field: 'batchSize',
label: '批量处理大小',
required: true,
component: 'InputNumber',
ifShow: ({ model }) => model.type === PolicyTypeEnum.BATCH,
},
];
export const processingStrategySchema: FormSchema[] = [
{
field: 'type',
label: '处理类型',
component: 'Select',
colProps: { span: 24 },
required: true,
componentProps: {
options: Object.keys(ProcessTypeLabelEnum).map((item) => ({
label: ProcessTypeLabelEnum[item],
value: ProcessTypeEnum[item],
})),
},
helpMessage: [
'失败与超时重试:重试处理包重所有失败和超时的消息',
'跳过所有失败:忽略所有失败',
'跳过所有失败和超时:忽略所有失败和超时',
'全部重试:重试处理包中的所有消息',
'失败重试:重试处理包重的所有失败消息',
'超时重试:重试处理包中的所有超时消息',
],
defaultValue: ProcessTypeEnum.SKIP_ALL_FAILURES,
},
{
field: 'retries',
label: '重试次数(0-无限制)',
required: true,
component: 'InputNumber',
colProps: { span: 12 },
},
{
field: 'failurePercentage',
label: '跳过重试的失败消息百分比',
required: true,
component: 'InputNumber',
colProps: { span: 12 },
},
{
field: 'pauseBetweenRetries',
label: '重试间隔(秒)',
required: true,
component: 'InputNumber',
colProps: { span: 12 },
},
{
field: 'maxPauseBetweenRetries',
label: '最大重试间隔(秒)',
required: true,
component: 'InputNumber',
colProps: { span: 12 },
},
];
export const pollingSettingsSchema: FormSchema[] = [
{
field: 'pollInterval',
label: '轮询间隔',
required: true,
colProps: { span: 12 },
component: 'InputNumber',
},
{
field: 'partitions',
label: '分区',
required: true,
colProps: { span: 12 },
component: 'InputNumber',
},
{
field: 'consumerPerPartition',
label: '每个分区消费者单独轮询消息',
required: true,
colProps: { span: 12 },
component: 'Checkbox',
},
{
field: 'packProcessingTimeout',
label: '处理超时(毫秒)',
required: true,
colProps: { span: 12 },
component: 'InputNumber',
},
];