TASK:aida;

This commit is contained in:
shahaibo
2024-09-27 15:33:20 +08:00
parent 9f5c901502
commit 05ddd33bcd
4 changed files with 77 additions and 26 deletions

View File

@@ -1,37 +1,57 @@
package com.ai.da.common.RabbitMQ;
import org.springframework.amqp.core.Queue;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import javax.annotation.PostConstruct;
@Configuration
public class MQConfig {
public static final String GENERATE_EXCHANGE_FANOUT = "generate-exchange";
// public static final String GENERATE_QUEUE = "generate-queue-prod";
// public static final String GENERATE_QUEUE = "generate-queue-test";
// ==================================================================
// public static final String GENERATE_QUEUE = "generate-queue-local";
public static final String GENERATE_QUEUE = "generate-queue-dev";
// public static final String GENERATE_QUEUE = "generate-queue-prod";
//
// public static final String SR_QUEUE = "SR-queue-local";
public static final String SR_QUEUE = "SR-queue-dev";
// public static final String SR_QUEUE = "SR-queue-prod";
//
// public static final String SR_RESULT_QUEUE = "SuperResolution-local";
public static final String SR_RESULT_QUEUE = "SuperResolution-dev";
// public static final String SR_RESULT_QUEUE = "SuperResolution-prod";
//
// public static final String GENERATE_RESULT_QUEUE = "GenerateImage-local";
public static final String GENERATE_RESULT_QUEUE = "GenerateImage-dev";
// public static final String GENERATE_RESULT_QUEUE = "GenerateImage-prod";
// 定义为非静态变量
@Value("${generate.exchange}")
private String generateExchange;
public static final String TO_PRODUCT_IMAGE_RESULT_QUEUE = "ToProductImage-dev";
// public static final String TO_PRODUCT_IMAGE_RESULT_QUEUE = "ToProductImage-prod";
@Value("${generate.queue}")
private String generateQueue;
public static final String RELIGHT_RESULT_QUEUE = "Relight-dev";
// public static final String RELIGHT_RESULT_QUEUE = "Relight-prod";
@Value("${sr.queue}")
private String srQueue;
@Value("${sr.result.queue}")
private String srResultQueue;
@Value("${generate.result.queue}")
private String generateResultQueue;
@Value("${to.product.image.result.queue}")
private String toProductImageResultQueue;
@Value("${relight.result.queue}")
private String relightResultQueue;
// 定义静态变量以供外部访问
public static String GENERATE_EXCHANGE;
public static String GENERATE_QUEUE;
public static String SR_QUEUE;
public static String SR_RESULT_QUEUE;
public static String GENERATE_RESULT_QUEUE;
public static String TO_PRODUCT_IMAGE_RESULT_QUEUE;
public static String RELIGHT_RESULT_QUEUE;
// 使用 @PostConstruct 在 bean 初始化之后,将实例变量值赋给静态变量
@PostConstruct
public void init() {
GENERATE_EXCHANGE = this.generateExchange;
GENERATE_QUEUE = this.generateQueue;
SR_QUEUE = this.srQueue;
SR_RESULT_QUEUE = this.srResultQueue;
GENERATE_RESULT_QUEUE = this.generateResultQueue;
TO_PRODUCT_IMAGE_RESULT_QUEUE = this.toProductImageResultQueue;
RELIGHT_RESULT_QUEUE = this.relightResultQueue;
}
public MQConfig() {
}