TASK:mq配置

This commit is contained in:
shahaibo
2024-09-24 15:43:37 +08:00
parent 56d0dcd25f
commit 41ffe335fc
4 changed files with 73 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() {
}

View File

@@ -92,4 +92,13 @@ redis.key.relightResultKey=Relight:Result
aws.s3.accessKeyId=AKIAVD3OJIMF6UJFLSHZ
aws.s3.secretKey=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
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

@@ -93,4 +93,13 @@ redis.key.relightResultKey=Relight:Result
aws.s3.accessKeyId=AKIAVD3OJIMF6UJFLSHZ
aws.s3.secretKey=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
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

@@ -85,4 +85,13 @@ redis.key.SRCancelSet=SRCancelSet
redis.key.SRExceptionMap=SRExceptionMap
redis.key.taskList=TaskList
redis.key.credits.pre-deduction=Credits:PreDeduction
redis.key.generateResult=Generate:Result
redis.key.generateResult=Generate:Result
# 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