Commit 1a39d208 1a39d2088c557b8a799be958bad87ae0262c8356 by xianghan

1.优化mq配置,添加默认数据源和默认队列

1 parent aae2399c
...@@ -18,6 +18,7 @@ import org.springframework.context.annotation.Primary; ...@@ -18,6 +18,7 @@ import org.springframework.context.annotation.Primary;
18 18
19 import javax.naming.ConfigurationException; 19 import javax.naming.ConfigurationException;
20 import java.util.Map; 20 import java.util.Map;
21 import java.util.Objects;
21 22
22 @Data 23 @Data
23 @Configuration 24 @Configuration
...@@ -166,34 +167,40 @@ public class RabbitMqSourceConfig { ...@@ -166,34 +167,40 @@ public class RabbitMqSourceConfig {
166 private Map<String, String> ucgEventInfo; 167 private Map<String, String> ucgEventInfo;
167 168
168 public String getUcgEventQueue(){ 169 public String getUcgEventQueue(){
170 if (Objects.nonNull(ucgEventInfo)) {
169 if (MapUtils.isNotEmpty(ucgEventInfo)) { 171 if (MapUtils.isNotEmpty(ucgEventInfo)) {
170 String queue = ucgEventInfo.get("queue"); 172 String queue = ucgEventInfo.get("queue");
171 return queue; 173 return queue;
172 } 174 }
175 }
173 176
174 return EVENT_QUEUE; 177 return EVENT_QUEUE;
175 } 178 }
176 179
177 public String getUcgEventSource(){ 180 public String getUcgEventSource(){
181 if (Objects.nonNull(ucgEventInfo)) {
178 if (MapUtils.isNotEmpty(ucgEventInfo)) { 182 if (MapUtils.isNotEmpty(ucgEventInfo)) {
179 String source = ucgEventInfo.get("active"); 183 String source = ucgEventInfo.get("active");
180 if (StringUtils.isNotBlank(source)) { 184 if (StringUtils.isNotBlank(source)) {
181 return this.chargeSource(source); 185 return this.chargeSource(source);
182 } else { 186 } else {
183 return ""; 187 return SERVICE_;
188 }
184 } 189 }
185 } 190 }
186 191
187 return null; 192 return SERVICE_;
188 } 193 }
189 194
190 public String getUcgEventStartUp(){ 195 public String getUcgEventStartUp(){
196 if (Objects.nonNull(ucgEventInfo)) {
191 if (MapUtils.isNotEmpty(ucgEventInfo)) { 197 if (MapUtils.isNotEmpty(ucgEventInfo)) {
192 String source = ucgEventInfo.get("active"); 198 String source = ucgEventInfo.get("active");
193 if (StringUtils.isNotBlank(source)) { 199 if (StringUtils.isNotBlank(source)) {
194 return "true"; 200 return "true";
195 } 201 }
196 } 202 }
203 }
197 204
198 return "false"; 205 return "false";
199 } 206 }
...@@ -209,34 +216,40 @@ public class RabbitMqSourceConfig { ...@@ -209,34 +216,40 @@ public class RabbitMqSourceConfig {
209 private Map<String, String> ucgIptvCollectionInfo; 216 private Map<String, String> ucgIptvCollectionInfo;
210 217
211 public String getUcgCollectionQueue(){ 218 public String getUcgCollectionQueue(){
219 if (Objects.nonNull(ucgIptvCollectionInfo)) {
212 if (MapUtils.isNotEmpty(ucgIptvCollectionInfo)) { 220 if (MapUtils.isNotEmpty(ucgIptvCollectionInfo)) {
213 String queue = ucgIptvCollectionInfo.get("queue"); 221 String queue = ucgIptvCollectionInfo.get("queue");
214 return queue; 222 return queue;
215 } 223 }
224 }
216 225
217 return COLLECTION_QUEUE; 226 return COLLECTION_QUEUE;
218 } 227 }
219 228
220 public String getUcgCollectionSource(){ 229 public String getUcgCollectionSource(){
230 if (Objects.nonNull(ucgIptvCollectionInfo)) {
221 if (MapUtils.isNotEmpty(ucgIptvCollectionInfo)) { 231 if (MapUtils.isNotEmpty(ucgIptvCollectionInfo)) {
222 String source = ucgIptvCollectionInfo.get("active"); 232 String source = ucgIptvCollectionInfo.get("active");
223 if (StringUtils.isNotBlank(source)) { 233 if (StringUtils.isNotBlank(source)) {
224 return this.chargeSource(source); 234 return this.chargeSource(source);
225 } else { 235 } else {
226 return ""; 236 return SERVICE_;
237 }
227 } 238 }
228 } 239 }
229 240
230 return null; 241 return SERVICE_;
231 } 242 }
232 243
233 public String getUcgCollectionStartUp(){ 244 public String getUcgCollectionStartUp(){
245 if (Objects.nonNull(ucgIptvCollectionInfo)) {
234 if (MapUtils.isNotEmpty(ucgIptvCollectionInfo)) { 246 if (MapUtils.isNotEmpty(ucgIptvCollectionInfo)) {
235 String source = ucgIptvCollectionInfo.get("active"); 247 String source = ucgIptvCollectionInfo.get("active");
236 if (StringUtils.isNotBlank(source)) { 248 if (StringUtils.isNotBlank(source)) {
237 return "true"; 249 return "true";
238 } 250 }
239 } 251 }
252 }
240 253
241 return "false"; 254 return "false";
242 } 255 }
...@@ -248,34 +261,40 @@ public class RabbitMqSourceConfig { ...@@ -248,34 +261,40 @@ public class RabbitMqSourceConfig {
248 private Map<String, String> viewRecordInfo; 261 private Map<String, String> viewRecordInfo;
249 262
250 public String getViewRecordQueue(){ 263 public String getViewRecordQueue(){
264 if (Objects.nonNull(viewRecordInfo)) {
251 if (MapUtils.isNotEmpty(viewRecordInfo)) { 265 if (MapUtils.isNotEmpty(viewRecordInfo)) {
252 String queue = viewRecordInfo.get("queue"); 266 String queue = viewRecordInfo.get("queue");
253 return queue; 267 return queue;
254 } 268 }
269 }
255 270
256 return VIEW_RECORD_QUEUE; 271 return VIEW_RECORD_QUEUE;
257 } 272 }
258 273
259 public String getViewRecordSource(){ 274 public String getViewRecordSource(){
275 if (Objects.nonNull(viewRecordInfo)) {
260 if (MapUtils.isNotEmpty(viewRecordInfo)) { 276 if (MapUtils.isNotEmpty(viewRecordInfo)) {
261 String source = viewRecordInfo.get("active"); 277 String source = viewRecordInfo.get("active");
262 if (StringUtils.isNotBlank(source)) { 278 if (StringUtils.isNotBlank(source)) {
263 return this.chargeSource(source); 279 return this.chargeSource(source);
264 } else { 280 } else {
265 return ""; 281 return SERVICE_;
282 }
266 } 283 }
267 } 284 }
268 285
269 return null; 286 return SERVICE_;
270 } 287 }
271 288
272 public String getViewRecordStartUp(){ 289 public String getViewRecordStartUp(){
290 if (Objects.nonNull(viewRecordInfo)) {
273 if (MapUtils.isNotEmpty(viewRecordInfo)) { 291 if (MapUtils.isNotEmpty(viewRecordInfo)) {
274 String source = viewRecordInfo.get("active"); 292 String source = viewRecordInfo.get("active");
275 if (StringUtils.isNotBlank(source)) { 293 if (StringUtils.isNotBlank(source)) {
276 return "true"; 294 return "true";
277 } 295 }
278 } 296 }
297 }
279 298
280 return "false"; 299 return "false";
281 } 300 }
...@@ -289,34 +308,40 @@ public class RabbitMqSourceConfig { ...@@ -289,34 +308,40 @@ public class RabbitMqSourceConfig {
289 private Map<String, String> uceInfo; 308 private Map<String, String> uceInfo;
290 309
291 public String getUceQueue(){ 310 public String getUceQueue(){
311 if (Objects.nonNull(uceInfo)) {
292 if (MapUtils.isNotEmpty(uceInfo)) { 312 if (MapUtils.isNotEmpty(uceInfo)) {
293 String queue = uceInfo.get("queue"); 313 String queue = uceInfo.get("queue");
294 return queue; 314 return queue;
295 } 315 }
316 }
296 317
297 return UCE_QUEUE; 318 return UCE_QUEUE;
298 } 319 }
299 320
300 public String getUceSource(){ 321 public String getUceSource(){
322 if (Objects.nonNull(uceInfo)) {
301 if (MapUtils.isNotEmpty(uceInfo)) { 323 if (MapUtils.isNotEmpty(uceInfo)) {
302 String source = uceInfo.get("active"); 324 String source = uceInfo.get("active");
303 if (StringUtils.isNotBlank(source)) { 325 if (StringUtils.isNotBlank(source)) {
304 return this.chargeSource(source); 326 return this.chargeSource(source);
305 } else { 327 } else {
306 return ""; 328 return MANAGEMENT_;
329 }
307 } 330 }
308 } 331 }
309 332
310 return null; 333 return MANAGEMENT_;
311 } 334 }
312 335
313 public String getUceStartUp(){ 336 public String getUceStartUp(){
337 if (Objects.nonNull(uceInfo)) {
314 if (MapUtils.isNotEmpty(uceInfo)) { 338 if (MapUtils.isNotEmpty(uceInfo)) {
315 String source = uceInfo.get("active"); 339 String source = uceInfo.get("active");
316 if (StringUtils.isNotBlank(source)) { 340 if (StringUtils.isNotBlank(source)) {
317 return "true"; 341 return "true";
318 } 342 }
319 } 343 }
344 }
320 345
321 return "false"; 346 return "false";
322 } 347 }
...@@ -330,35 +355,39 @@ public class RabbitMqSourceConfig { ...@@ -330,35 +355,39 @@ public class RabbitMqSourceConfig {
330 private Map<String, String> eventBusInfo; 355 private Map<String, String> eventBusInfo;
331 356
332 public String getEventBusQueue(){ 357 public String getEventBusQueue(){
358 if (Objects.nonNull(eventBusInfo)) {
333 if (MapUtils.isNotEmpty(eventBusInfo)) { 359 if (MapUtils.isNotEmpty(eventBusInfo)) {
334 String queue = eventBusInfo.get("queue"); 360 String queue = eventBusInfo.get("queue");
335 return queue; 361 return queue;
336 } 362 }
337 363 }
338 return UC_EVENTBUS_QUEUE; 364 return UC_EVENTBUS_QUEUE;
339 } 365 }
340 366
341 public String getEventBusSource(){ 367 public String getEventBusSource(){
368 if (Objects.nonNull(eventBusInfo)) {
342 if (MapUtils.isNotEmpty(eventBusInfo)) { 369 if (MapUtils.isNotEmpty(eventBusInfo)) {
343 String source = eventBusInfo.get("active"); 370 String source = eventBusInfo.get("active");
344 if (StringUtils.isNotBlank(source)) { 371 if (StringUtils.isNotBlank(source)) {
345 return this.chargeSource(source); 372 return this.chargeSource(source);
346 } else { 373 } else {
347 return ""; 374 return SERVICE_;
375 }
348 } 376 }
349 } 377 }
350 378
351 return null; 379 return SERVICE_;
352 } 380 }
353 381
354 public String getEventBusStartUp(){ 382 public String getEventBusStartUp(){
383 if (Objects.nonNull(eventBusInfo)) {
355 if (MapUtils.isNotEmpty(eventBusInfo)) { 384 if (MapUtils.isNotEmpty(eventBusInfo)) {
356 String source = eventBusInfo.get("active"); 385 String source = eventBusInfo.get("active");
357 if (StringUtils.isNotBlank(source)) { 386 if (StringUtils.isNotBlank(source)) {
358 return "true"; 387 return "true";
359 } 388 }
360 } 389 }
361 390 }
362 return "false"; 391 return "false";
363 } 392 }
364 393
...@@ -371,34 +400,39 @@ public class RabbitMqSourceConfig { ...@@ -371,34 +400,39 @@ public class RabbitMqSourceConfig {
371 private Map<String, String> wechatInfo; 400 private Map<String, String> wechatInfo;
372 401
373 public String getWechatQueue(){ 402 public String getWechatQueue(){
403 if (Objects.nonNull(wechatInfo)) {
374 if (MapUtils.isNotEmpty(wechatInfo)) { 404 if (MapUtils.isNotEmpty(wechatInfo)) {
375 String queue = wechatInfo.get("queue"); 405 String queue = wechatInfo.get("queue");
376 return queue; 406 return queue;
377 } 407 }
378 408 }
379 return WEIXIN_SUBORUNSUB_QUEUE; 409 return WEIXIN_SUBORUNSUB_QUEUE;
380 } 410 }
381 411
382 public String getWechatSource(){ 412 public String getWechatSource(){
413 if (Objects.nonNull(wechatInfo)) {
383 if (MapUtils.isNotEmpty(wechatInfo)) { 414 if (MapUtils.isNotEmpty(wechatInfo)) {
384 String source = wechatInfo.get("active"); 415 String source = wechatInfo.get("active");
385 if (StringUtils.isNotBlank(source)) { 416 if (StringUtils.isNotBlank(source)) {
386 return this.chargeSource(source); 417 return this.chargeSource(source);
387 } else { 418 } else {
388 return ""; 419 return SERVICE_;
420 }
389 } 421 }
390 } 422 }
391 423
392 return null; 424 return SERVICE_;
393 } 425 }
394 426
395 public String getWechatStartUp(){ 427 public String getWechatStartUp(){
428 if (Objects.nonNull(wechatInfo)) {
396 if (MapUtils.isNotEmpty(wechatInfo)) { 429 if (MapUtils.isNotEmpty(wechatInfo)) {
397 String source = wechatInfo.get("active"); 430 String source = wechatInfo.get("active");
398 if (StringUtils.isNotBlank(source)) { 431 if (StringUtils.isNotBlank(source)) {
399 return "true"; 432 return "true";
400 } 433 }
401 } 434 }
435 }
402 436
403 return "false"; 437 return "false";
404 } 438 }
......
...@@ -79,7 +79,7 @@ mutil-mq: ...@@ -79,7 +79,7 @@ mutil-mq:
79 # password: Topdraw1qaz 79 # password: Topdraw1qaz
80 # 虚拟空间 80 # 虚拟空间
81 # virtual-host: member_center_iptv_sichuan 81 # virtual-host: member_center_iptv_sichuan
82 virtual-host: member_center_iptv_chongshu 82 virtual-host: user_center
83 publisher-confirms: true #如果对异步消息需要回调必须设置为true 83 publisher-confirms: true #如果对异步消息需要回调必须设置为true
84 84
85 # 管理侧 85 # 管理侧
...@@ -99,42 +99,60 @@ mutil-mq: ...@@ -99,42 +99,60 @@ mutil-mq:
99 service: 99 service:
100 mq: 100 mq:
101 list: 101 list:
102 - source: event 102 # - source: event
103 exchange: event.exchange 103 # exchange: event.exchange
104 queue: event.queue 104 # queue: event.queue
105 # exchange-type: direct
106 # routing-key:
107 # active: service
108 - source: collection
109 exchange: userCenter_exchange
110 queue: queue.collection.add
105 exchange-type: direct 111 exchange-type: direct
106 routing-key: 112 routing-key: route.UserCollection.add
107 active: service 113 active: service
108 - source: collection 114 - source: collection
109 exchange: collection.exchange 115 exchange: userCenter_exchange
110 queue: collection.queue 116 queue: queue.collection.delete
111 exchange-type: direct 117 exchange-type: direct
112 routing-key: service 118 routing-key: route.UserCollection.delete
113 active: service 119 active: service
114 - source: viewRecord 120 - source: collection
115 exchange: viewRecord.exchange 121 exchange: userCenter_exchange
116 queue: viewRecord.queue 122 queue: queue.collection.deleteall
117 exchange-type: direct 123 exchange-type: direct
118 routing-key: 124 routing-key: route.UserCollection.deleteall
119 active: service 125 active: service
120 - source: eventBus 126 - source: collection
121 exchange: uc.eventbus 127 exchange: exchange.collection
122 queue: uc.eventbus 128 queue: collection.queue
123 exchange-type: topic 129 exchange-type: direct
124 routing-key: uc.eventbus.*.topic 130 routing-key:
125 active: service 131 active: service
132 # - source: viewRecord
133 # exchange: viewRecord.exchange
134 # queue: viewRecord.queue
135 # exchange-type: direct
136 # routing-key:
137 # active: service
138 # - source: eventBus
139 # exchange: uc.eventbus
140 # queue: uc.eventbus
141 # exchange-type: topic
142 # routing-key: uc.eventbus.*.topic
143 # active: service
126 - source: uce 144 - source: uce
127 exchange: uce.exchange 145 exchange: uce.exchange
128 queue: uce.queue 146 queue: uce.queue
129 exchange-type: direct 147 exchange-type: direct
130 routing-key: 148 routing-key:
131 active: management 149 active: management
132 - source: wechat 150 # - source: wechat
133 exchange: weixin.subOrUnSub.direct 151 # exchange: weixin.subOrUnSub.direct
134 queue: weixin.subOrUnSub.queue 152 # queue: weixin.subOrUnSub.queue
135 exchange-type: direct 153 # exchange-type: direct
136 routing-key: 154 # routing-key:
137 active: 155 # active: active
138 error: 156 error:
139 logs: 157 logs:
140 list: 158 list:
......