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; package com.ai.da.common.RabbitMQ;
import org.springframework.amqp.core.Queue; import org.springframework.amqp.core.Queue;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import javax.annotation.PostConstruct;
@Configuration @Configuration
public class MQConfig { public class MQConfig {
public static final String GENERATE_EXCHANGE_FANOUT = "generate-exchange"; // 定义为非静态变量
// public static final String GENERATE_QUEUE = "generate-queue-prod"; @Value("${generate.exchange}")
// public static final String GENERATE_QUEUE = "generate-queue-test"; private String generateExchange;
// ==================================================================
// 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";
public static final String TO_PRODUCT_IMAGE_RESULT_QUEUE = "ToProductImage-dev"; @Value("${generate.queue}")
// public static final String TO_PRODUCT_IMAGE_RESULT_QUEUE = "ToProductImage-prod"; private String generateQueue;
public static final String RELIGHT_RESULT_QUEUE = "Relight-dev"; @Value("${sr.queue}")
// public static final String RELIGHT_RESULT_QUEUE = "Relight-prod"; 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() { public MQConfig() {
} }

View File

@@ -96,3 +96,12 @@ redis.key.maximumUserId=CodeCreate:MaximumUserId
aws.s3.accessKeyId=AKIAVD3OJIMF6UJFLSHZ aws.s3.accessKeyId=AKIAVD3OJIMF6UJFLSHZ
aws.s3.secretKey=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 aws.s3.secretKey=LNIwFFB27/QedtZ+Q/viVUoX9F5x1DbuM8N0DkD8
aws.s3.regionName=ap-east-1 aws.s3.regionName=ap-east-1
# RabbitMQ Exchange and Queue configurations
generate.exchange=generate-exchange
generate.queue=generate-queue-dev
sr.queue=SR-queue-dev
sr.result.queue=SuperResolution-dev
generate.result.queue=GenerateImage-dev
to.product.image.result.queue=ToProductImage-dev
relight.result.queue=Relight-dev

View File

@@ -94,3 +94,12 @@ redis.key.relightResultKey=Relight:Result
aws.s3.accessKeyId=AKIAVD3OJIMF6UJFLSHZ aws.s3.accessKeyId=AKIAVD3OJIMF6UJFLSHZ
aws.s3.secretKey=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 aws.s3.secretKey=LNIwFFB27/QedtZ+Q/viVUoX9F5x1DbuM8N0DkD8
aws.s3.regionName=ap-east-1 aws.s3.regionName=ap-east-1
# RabbitMQ Exchange and Queue configurations
generate.exchange=generate-exchange
generate.queue=generate-queue-prod
sr.queue=SR-queue-prod
sr.result.queue=SuperResolution-prod
generate.result.queue=GenerateImage-prod
to.product.image.result.queue=ToProductImage-prod
relight.result.queue=Relight-prod

View File

@@ -86,3 +86,16 @@ redis.key.SRExceptionMap=SRExceptionMap
redis.key.taskList=TaskList redis.key.taskList=TaskList
redis.key.credits.pre-deduction=Credits:PreDeduction redis.key.credits.pre-deduction=Credits:PreDeduction
redis.key.generateResult=Generate:Result redis.key.generateResult=Generate:Result
aws.s3.accessKeyId=AKIAVD3OJIMF6UJFLSHZ
aws.s3.secretKey=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
aws.s3.regionName=ap-east-1
# RabbitMQ Exchange and Queue configurations
generate.exchange=generate-exchange
generate.queue=generate-queue-test
sr.queue=SR-queue-test
sr.result.queue=SuperResolution-test
generate.result.queue=GenerateImage-test
to.product.image.result.queue=ToProductImage-test
relight.result.queue=Relight-test