提交
This commit is contained in:
98
jeepay-components/jeepay-components-mq/pom.xml
Normal file
98
jeepay-components/jeepay-components-mq/pom.xml
Normal file
@@ -0,0 +1,98 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion> <!-- POM模型版本 -->
|
||||
|
||||
<groupId>com.jeequan</groupId> <!-- 组织名, 类似于包名 -->
|
||||
<artifactId>jeepay-components-mq</artifactId> <!-- 项目名称 -->
|
||||
<packaging>jar</packaging> <!-- 项目的最终打包类型/发布形式, 可选[jar, war, pom, maven-plugin]等 -->
|
||||
<version>${isys.version}</version> <!-- 项目当前版本号 -->
|
||||
<description>Jeepay计全支付系统 [jeepay-components-mq]</description> <!-- 项目描述 -->
|
||||
<url>https://www.jeequan.com</url>
|
||||
|
||||
<parent>
|
||||
<groupId>com.jeequan</groupId>
|
||||
<artifactId>jeepay-components</artifactId>
|
||||
<version>Final</version>
|
||||
</parent>
|
||||
|
||||
<!-- 项目属性 -->
|
||||
<properties>
|
||||
<projectRootDir>${basedir}/../../</projectRootDir>
|
||||
</properties>
|
||||
|
||||
<!-- 项目依赖声明 -->
|
||||
<dependencies>
|
||||
|
||||
<!-- 依赖Core项目 -->
|
||||
<dependency>
|
||||
<groupId>com.jeequan</groupId>
|
||||
<artifactId>jeepay-components-core</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>javax.annotation</groupId>
|
||||
<artifactId>javax.annotation-api</artifactId>
|
||||
<scope>provided</scope> <!-- 仅编译依赖该jar, 运行时存在 -->
|
||||
</dependency>
|
||||
|
||||
<!-- ↓↓↓↓↓↓ MQ依赖包 ↓↓↓↓↓↓ -->
|
||||
<!-- 使用的厂商 scope=compile, 否则需要scope=provided(仅编译,不依赖) -->
|
||||
|
||||
<!-- ActiveMQ 和 连接池 -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-activemq</artifactId>
|
||||
<!-- <scope>provided</scope>-->
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.activemq</groupId>
|
||||
<artifactId>activemq-pool</artifactId>
|
||||
<!-- <scope>provided</scope>-->
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.messaginghub</groupId>
|
||||
<artifactId>pooled-jms</artifactId>
|
||||
<!-- <scope>provided</scope>-->
|
||||
</dependency>
|
||||
|
||||
|
||||
<!-- RabbitMQ -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-amqp</artifactId>
|
||||
<!-- <scope>provided</scope>-->
|
||||
</dependency>
|
||||
|
||||
<!-- RocketMQ -->
|
||||
<dependency>
|
||||
<groupId>org.apache.rocketmq</groupId>
|
||||
<artifactId>rocketmq-spring-boot-starter</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- AliyunRocketMQ -->
|
||||
<dependency>
|
||||
<groupId>com.aliyun.openservices</groupId>
|
||||
<artifactId>ons-client</artifactId>
|
||||
<!-- <scope>provided</scope>-->
|
||||
</dependency>
|
||||
|
||||
<!-- ↑↑↑↑↑↑ MQ依赖包 ↑↑↑↑↑↑ -->
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>src/main/resources</directory>
|
||||
</resource>
|
||||
<resource>
|
||||
<directory>src/main/java</directory>
|
||||
<includes><include>**/*.xml</include></includes><!-- maven可以将mapper.xml进行打包处理,否则仅对java文件处理 -->
|
||||
</resource>
|
||||
</resources>
|
||||
|
||||
</build>
|
||||
|
||||
</project>
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.jeequan.jeepay.components.mq.constant;
|
||||
|
||||
/**
|
||||
* 定义MQ消息类型
|
||||
* @author terrfly
|
||||
*
|
||||
* @date 2021/7/23 16:49
|
||||
*/
|
||||
public enum MQSendTypeEnum {
|
||||
/** QUEUE - 点对点 (只有1个消费者可消费。 ActiveMQ的queue模式 ) **/
|
||||
QUEUE,
|
||||
/** BROADCAST - 订阅模式 (所有接收者都可接收到。 ActiveMQ的topic模式, RabbitMQ的fanout类型的交换机, RocketMQ的广播模式 ) **/
|
||||
BROADCAST
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.jeequan.jeepay.components.mq.constant;
|
||||
|
||||
/**
|
||||
* MQ 厂商定义类
|
||||
*
|
||||
* @author terrfly
|
||||
*
|
||||
* @date 2021/7/23 16:50
|
||||
*/
|
||||
public class MQVenderCS {
|
||||
|
||||
public static final String YML_VENDER_KEY = "isys.mq.vender";
|
||||
|
||||
public static final String ACTIVE_MQ = "activeMQ";
|
||||
public static final String RABBIT_MQ = "rabbitMQ";
|
||||
public static final String ROCKET_MQ = "rocketMQ";
|
||||
public static final String ALIYUN_ROCKET_MQ = "aliYunRocketMQ";
|
||||
|
||||
}
|
||||
@@ -0,0 +1,186 @@
|
||||
package com.jeequan.jeepay.components.mq.executor;
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.scheduling.annotation.EnableAsync;
|
||||
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
|
||||
|
||||
import java.util.concurrent.Executor;
|
||||
import java.util.concurrent.ThreadPoolExecutor;
|
||||
|
||||
/**
|
||||
* MQ 线程池配置
|
||||
*
|
||||
* @author terrfly
|
||||
*
|
||||
* @date 2021/6/8 17:33
|
||||
*/
|
||||
@Configuration
|
||||
@EnableAsync
|
||||
public class MqThreadExecutor {
|
||||
|
||||
/**
|
||||
* 商户进件处理
|
||||
*/
|
||||
public static final String EXECUTOR_MCH_AUDIT = "mqQueue4MchAuditExecutor";
|
||||
|
||||
/**
|
||||
* 通用的线程池,一般不与外部接口交互的都可使用该线程池
|
||||
*/
|
||||
public static final String EXECUTOR_COMMON = "mqQueue4CommonExecutor";
|
||||
/**
|
||||
* 商户订单通知处理线程池
|
||||
*/
|
||||
public static final String EXECUTOR_PAY_ORDER_MCH_NOTIFY = "mqQueue4PayOrderMchNotifyExecutor";
|
||||
/**
|
||||
* APP推送处理线程池
|
||||
*/
|
||||
public static final String EXECUTOR_APP_PUSH = "mqQueue4AppPushExecutor";
|
||||
/**
|
||||
* 订单分账处理线程池
|
||||
*/
|
||||
public static final String EXECUTOR_PAY_ORDER_DIVISION = "mqQueue4PayOrderDivisionExecutor";
|
||||
/**
|
||||
* 订单补单处理线程池
|
||||
*/
|
||||
public static final String EXECUTOR_PAY_ORDER_REISSUE = "mqQueue4PayOrderReissueExecutor";
|
||||
/**
|
||||
* 推送云打印处理线程池
|
||||
*/
|
||||
public static final String EXECUTOR_PUSH_PRINTER = "mqQueue4PushPrinterExecutor";
|
||||
/**
|
||||
* 推送云播报处理线程池
|
||||
*/
|
||||
public static final String EXECUTOR_PUSH_SPEAKER = "mqQueue4PushSpeakerExecutor";
|
||||
/**
|
||||
* 推送公众号消息处理线程池
|
||||
*/
|
||||
public static final String EXECUTOR_PUSH_MP_MSG = "mqQueue4PushWxMpMsgExecutor";
|
||||
/**
|
||||
* 直付通结算订单处理线程池
|
||||
*/
|
||||
public static final String EXECUTOR_ZFT_SETT_ORDER = "mqQueue4ZftSettOrderExecutor";
|
||||
/**
|
||||
* 订单支付成功自动提现线程池
|
||||
*/
|
||||
public static final String EXECUTOR_PAY_ORDER_CASHOUT = "mqQueue4PayOrderCashoutExecutor";
|
||||
|
||||
/**
|
||||
* 账户余额线程池
|
||||
*/
|
||||
public static final String EXECUTOR_ACCOUNT_BALANCE = "mqQueue4AccountBalanceExecutor";
|
||||
|
||||
/**
|
||||
* 订单营销活动线程池
|
||||
*/
|
||||
public static final String EXECUTOR_PAY_ORDER_MARKET = "mqQueue4PayOrderMarketExecutor";
|
||||
|
||||
|
||||
/**
|
||||
* 默认核心线程数量
|
||||
*/
|
||||
private static final int DEFAULT_CORE_POOL_SIZE = 10;
|
||||
/**
|
||||
* 默认最大线程数量
|
||||
*/
|
||||
private static final int DEFAULT_MAX_POOL_SIZE = 50;
|
||||
/**
|
||||
* 缓存队列
|
||||
*/
|
||||
private static final int DEFAULT_QUEUE_CAPACITY = 200;
|
||||
/**
|
||||
* 允许的空闲时间,单位秒
|
||||
*/
|
||||
private static final int DEFAULT_KEEP_ALIVE_SECONDS = 60;
|
||||
|
||||
@Bean
|
||||
public Executor mqQueue4CommonExecutor() {
|
||||
return createExecutor(EXECUTOR_COMMON, DEFAULT_CORE_POOL_SIZE, DEFAULT_MAX_POOL_SIZE, DEFAULT_QUEUE_CAPACITY, DEFAULT_KEEP_ALIVE_SECONDS);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public Executor mqQueue4MchAuditExecutor() {
|
||||
return createExecutor(EXECUTOR_MCH_AUDIT, DEFAULT_CORE_POOL_SIZE, DEFAULT_MAX_POOL_SIZE, DEFAULT_QUEUE_CAPACITY, DEFAULT_KEEP_ALIVE_SECONDS);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Bean
|
||||
public Executor mqQueue4PayOrderMchNotifyExecutor() {
|
||||
return createExecutor(EXECUTOR_PAY_ORDER_MCH_NOTIFY, DEFAULT_CORE_POOL_SIZE, DEFAULT_MAX_POOL_SIZE, DEFAULT_QUEUE_CAPACITY, DEFAULT_KEEP_ALIVE_SECONDS);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public Executor mqQueue4AppPushExecutor() {
|
||||
return createExecutor(EXECUTOR_APP_PUSH, DEFAULT_CORE_POOL_SIZE, DEFAULT_MAX_POOL_SIZE, DEFAULT_QUEUE_CAPACITY, DEFAULT_KEEP_ALIVE_SECONDS);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public Executor mqQueue4PayOrderDivisionExecutor() {
|
||||
return createExecutor(EXECUTOR_PAY_ORDER_DIVISION, DEFAULT_CORE_POOL_SIZE, DEFAULT_MAX_POOL_SIZE, DEFAULT_QUEUE_CAPACITY, DEFAULT_KEEP_ALIVE_SECONDS);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public Executor mqQueue4PayOrderReissueExecutor() {
|
||||
return createExecutor(EXECUTOR_PAY_ORDER_REISSUE, DEFAULT_CORE_POOL_SIZE, DEFAULT_MAX_POOL_SIZE, DEFAULT_QUEUE_CAPACITY, DEFAULT_KEEP_ALIVE_SECONDS);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public Executor mqQueue4PushPrinterExecutor() {
|
||||
return createExecutor(EXECUTOR_PUSH_PRINTER, DEFAULT_CORE_POOL_SIZE, DEFAULT_MAX_POOL_SIZE, DEFAULT_QUEUE_CAPACITY, DEFAULT_KEEP_ALIVE_SECONDS);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public Executor mqQueue4PushSpeakerExecutor() {
|
||||
return createExecutor(EXECUTOR_PUSH_SPEAKER, DEFAULT_CORE_POOL_SIZE, DEFAULT_MAX_POOL_SIZE, DEFAULT_QUEUE_CAPACITY, DEFAULT_KEEP_ALIVE_SECONDS);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public Executor mqQueue4PushWxMpMsgExecutor() {
|
||||
return createExecutor(EXECUTOR_PUSH_MP_MSG, DEFAULT_CORE_POOL_SIZE, DEFAULT_MAX_POOL_SIZE, DEFAULT_QUEUE_CAPACITY, DEFAULT_KEEP_ALIVE_SECONDS);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public Executor mqQueue4ZftSettOrderExecutor() {
|
||||
return createExecutor(EXECUTOR_ZFT_SETT_ORDER, DEFAULT_CORE_POOL_SIZE, DEFAULT_MAX_POOL_SIZE, DEFAULT_QUEUE_CAPACITY, DEFAULT_KEEP_ALIVE_SECONDS);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public Executor mqQueue4PayOrderCashoutExecutor() {
|
||||
return createExecutor(EXECUTOR_PAY_ORDER_CASHOUT, DEFAULT_CORE_POOL_SIZE, DEFAULT_MAX_POOL_SIZE, DEFAULT_QUEUE_CAPACITY, DEFAULT_KEEP_ALIVE_SECONDS);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public Executor mqQueue4AccountBalanceExecutor() {
|
||||
return createExecutor(EXECUTOR_ACCOUNT_BALANCE, DEFAULT_CORE_POOL_SIZE, DEFAULT_MAX_POOL_SIZE, DEFAULT_QUEUE_CAPACITY, DEFAULT_KEEP_ALIVE_SECONDS);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public Executor mqQueue4PayOrderMarketExecutor() {
|
||||
return createExecutor(EXECUTOR_PAY_ORDER_MARKET, DEFAULT_CORE_POOL_SIZE, DEFAULT_MAX_POOL_SIZE, DEFAULT_QUEUE_CAPACITY, DEFAULT_KEEP_ALIVE_SECONDS);
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建 Executor
|
||||
* @param threadNamePrefix 线程名称的前缀
|
||||
* @param corePoolSize 核心线程数, 根据机器的配置进行添加
|
||||
* @param maxPoolSize 最大线程数
|
||||
* @param queueCapacity 缓存队列,缓存队列尽量减少,否则将堵塞在队列中无法执行
|
||||
* @param keepAliveSeconds 允许的空闲时间
|
||||
* @return
|
||||
*/
|
||||
protected Executor createExecutor(String threadNamePrefix, int corePoolSize, int maxPoolSize, int queueCapacity, int keepAliveSeconds) {
|
||||
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
|
||||
executor.setCorePoolSize(corePoolSize);
|
||||
executor.setMaxPoolSize(maxPoolSize);
|
||||
executor.setQueueCapacity(queueCapacity);
|
||||
executor.setThreadNamePrefix(threadNamePrefix);
|
||||
// rejection-policy:当pool已经达到max size的时候,如何处理新任务
|
||||
// CALLER_RUNS:不在新线程中执行任务,而是由调用者所在的线程来执行
|
||||
executor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy());
|
||||
executor.setKeepAliveSeconds(keepAliveSeconds);
|
||||
executor.initialize();
|
||||
return executor;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.jeequan.jeepay.components.mq.model;
|
||||
|
||||
import com.jeequan.jeepay.components.mq.constant.MQSendTypeEnum;
|
||||
|
||||
/**
|
||||
* 定义MQ消息格式
|
||||
*
|
||||
* @author terrfly
|
||||
* @date 2021/7/22 15:33
|
||||
*/
|
||||
public abstract class AbstractMQ {
|
||||
|
||||
/**
|
||||
* MQ名称
|
||||
**/
|
||||
public abstract String getMQName();
|
||||
|
||||
/**
|
||||
* MQ 类型
|
||||
**/
|
||||
public abstract MQSendTypeEnum getMQType();
|
||||
|
||||
/**
|
||||
* 构造MQ消息体 String类型
|
||||
**/
|
||||
public abstract String toMessage();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
package com.jeequan.jeepay.components.mq.model;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.jeequan.jeepay.components.mq.constant.MQSendTypeEnum;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* TODO
|
||||
* 账户余额消息mq
|
||||
* @author crystal
|
||||
* @date 2023/12/19 14:37
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class AccountBalanceMQ extends AbstractMQ {
|
||||
|
||||
/** 【!重要配置项!】 定义MQ名称 **/
|
||||
public static final String MQ_NAME = "QUEUE_ACCOUNT_BALANCE_MCH";
|
||||
|
||||
/** 内置msg 消息体定义 **/
|
||||
private MsgPayload payload;
|
||||
|
||||
/** 【!重要配置项!】 定义Msg消息载体 **/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
public static class MsgPayload {
|
||||
/** 账户号 **/
|
||||
private String accountNo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMQName() {
|
||||
return MQ_NAME;
|
||||
}
|
||||
|
||||
@Override
|
||||
public MQSendTypeEnum getMQType() {
|
||||
return MQSendTypeEnum.QUEUE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toMessage() {
|
||||
return JSONObject.toJSONString(payload);
|
||||
}
|
||||
|
||||
|
||||
/** 【!重要配置项!】 构造MQModel , 一般用于发送MQ时 **/
|
||||
public static AccountBalanceMQ build(String accountNo){
|
||||
return new AccountBalanceMQ(new MsgPayload(accountNo));
|
||||
}
|
||||
|
||||
/** 解析MQ消息, 一般用于接收MQ消息时 **/
|
||||
public static MsgPayload parse(String msg){
|
||||
return JSON.parseObject(msg, MsgPayload.class);
|
||||
}
|
||||
|
||||
/** 定义 IMQReceiver 接口: 项目实现该接口则可接收到对应的业务消息 **/
|
||||
public interface IMQReceiver{
|
||||
void receive(MsgPayload payload);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
package com.jeequan.jeepay.components.mq.model;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.jeequan.jeepay.components.mq.constant.MQSendTypeEnum;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* 定义MQ消息格式
|
||||
* 业务场景: app推送[ 新订单提醒 ]
|
||||
*
|
||||
* @author zx
|
||||
* @date 2021/01/04 15:25
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class AppPushMQ extends AbstractMQ {
|
||||
|
||||
/**
|
||||
* 【!重要配置项!】 定义MQ名称
|
||||
**/
|
||||
public static final String MQ_NAME = "QUEUE_APP_PUSH";
|
||||
|
||||
/**
|
||||
* 内置msg 消息体定义
|
||||
**/
|
||||
private MsgPayload payload;
|
||||
|
||||
/**
|
||||
* 【!重要配置项!】 定义Msg消息载体
|
||||
**/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
public static class MsgPayload {
|
||||
|
||||
/**
|
||||
* 支付订单号
|
||||
**/
|
||||
private String payOrderId;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMQName() {
|
||||
return MQ_NAME;
|
||||
}
|
||||
|
||||
/**
|
||||
* 【!重要配置项!】
|
||||
**/
|
||||
@Override
|
||||
public MQSendTypeEnum getMQType() {
|
||||
return MQSendTypeEnum.QUEUE; // QUEUE - 点对点 、 BROADCAST - 广播模式
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toMessage() {
|
||||
return JSONObject.toJSONString(payload);
|
||||
}
|
||||
|
||||
/**
|
||||
* 【!重要配置项!】 构造MQModel , 一般用于发送MQ时
|
||||
**/
|
||||
public static AppPushMQ build(String payOrderId) {
|
||||
return new AppPushMQ(new MsgPayload(payOrderId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 解析MQ消息, 一般用于接收MQ消息时
|
||||
**/
|
||||
public static MsgPayload parse(String msg) {
|
||||
return JSON.parseObject(msg, MsgPayload.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* 定义 IMQReceiver 接口: 项目实现该接口则可接收到对应的业务消息
|
||||
**/
|
||||
public interface IMQReceiver {
|
||||
void receive(MsgPayload payload);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,106 @@
|
||||
package com.jeequan.jeepay.components.mq.model;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.jeequan.jeepay.components.mq.constant.MQSendTypeEnum;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 定义MQ消息格式
|
||||
* 业务场景: [ 清除服务商登录信息 ]
|
||||
*
|
||||
* @author terrfly
|
||||
* @date 2022/03/29 13:35
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class CleanAgentLoginAuthCacheMQ extends AbstractMQ {
|
||||
|
||||
/**
|
||||
* 【!重要配置项!】 定义MQ名称
|
||||
**/
|
||||
public static final String MQ_NAME = "QUEUE_CLEAN_AGENT_LOGIN_AUTH_CACHE";
|
||||
|
||||
/**
|
||||
* 清空缓存类型
|
||||
**/
|
||||
public static final String CLEAN_CACHE_TYPE_LOGIN_TOKEN = "loginToken"; // 登录token
|
||||
public static final String CLEAN_CACHE_TYPE_LOGIN_ERR = "loginErr"; // 登录限制
|
||||
|
||||
/**
|
||||
* 内置msg 消息体定义
|
||||
**/
|
||||
private MsgPayload payload;
|
||||
|
||||
/**
|
||||
* 【!重要配置项!】 定义Msg消息载体
|
||||
**/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
public static class MsgPayload {
|
||||
|
||||
/**
|
||||
* 清空缓存类型,默认清空 登录token类型
|
||||
**/
|
||||
private String cleanCacheType;
|
||||
|
||||
/**
|
||||
* 清空缓存用户列表
|
||||
**/
|
||||
private List<String> list;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMQName() {
|
||||
return MQ_NAME;
|
||||
}
|
||||
|
||||
/**
|
||||
* 【!重要配置项!】
|
||||
**/
|
||||
@Override
|
||||
public MQSendTypeEnum getMQType() {
|
||||
return MQSendTypeEnum.QUEUE; // QUEUE - 点对点 、 BROADCAST - 广播模式
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toMessage() {
|
||||
return JSONObject.toJSONString(payload);
|
||||
}
|
||||
|
||||
/**
|
||||
* 【!重要配置项!】 构造MQModel , 一般用于发送MQ时
|
||||
**/
|
||||
public static CleanAgentLoginAuthCacheMQ build(List<Long> list) {
|
||||
return build(list.stream().map(String::valueOf).collect(Collectors.toList()), CLEAN_CACHE_TYPE_LOGIN_TOKEN);
|
||||
}
|
||||
|
||||
/**
|
||||
* 【!重要配置项!】 构造MQModel , 一般用于发送MQ时
|
||||
**/
|
||||
public static CleanAgentLoginAuthCacheMQ build(List<String> list, String cleanCacheType) {
|
||||
return new CleanAgentLoginAuthCacheMQ(new CleanAgentLoginAuthCacheMQ.MsgPayload(cleanCacheType, list));
|
||||
}
|
||||
|
||||
/**
|
||||
* 解析MQ消息, 一般用于接收MQ消息时
|
||||
**/
|
||||
public static MsgPayload parse(String msg) {
|
||||
return JSON.parseObject(msg, MsgPayload.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* 定义 IMQReceiver 接口: 项目实现该接口则可接收到对应的业务消息
|
||||
**/
|
||||
public interface IMQReceiver {
|
||||
void receive(MsgPayload payload);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,106 @@
|
||||
package com.jeequan.jeepay.components.mq.model;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.jeequan.jeepay.components.mq.constant.MQSendTypeEnum;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 定义MQ消息格式
|
||||
* 业务场景: [ 清除商户登录信息 ]
|
||||
*
|
||||
* @author terrfly
|
||||
* @date 2021/7/22 15:25
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class CleanMchLoginAuthCacheMQ extends AbstractMQ {
|
||||
|
||||
/**
|
||||
* 【!重要配置项!】 定义MQ名称
|
||||
**/
|
||||
public static final String MQ_NAME = "QUEUE_CLEAN_MCH_LOGIN_AUTH_CACHE";
|
||||
|
||||
/**
|
||||
* 清空缓存类型
|
||||
**/
|
||||
public static final String CLEAN_CACHE_TYPE_LOGIN_TOKEN = "loginToken"; // 登录token
|
||||
public static final String CLEAN_CACHE_TYPE_LOGIN_ERR = "loginErr"; // 登录限制
|
||||
|
||||
/**
|
||||
* 内置msg 消息体定义
|
||||
**/
|
||||
private MsgPayload payload;
|
||||
|
||||
/**
|
||||
* 【!重要配置项!】 定义Msg消息载体
|
||||
**/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
public static class MsgPayload {
|
||||
|
||||
/**
|
||||
* 清空缓存类型,默认清空 登录token类型
|
||||
**/
|
||||
private String cleanCacheType;
|
||||
|
||||
/**
|
||||
* 清空缓存用户列表
|
||||
**/
|
||||
private List<String> list;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMQName() {
|
||||
return MQ_NAME;
|
||||
}
|
||||
|
||||
/**
|
||||
* 【!重要配置项!】
|
||||
**/
|
||||
@Override
|
||||
public MQSendTypeEnum getMQType() {
|
||||
return MQSendTypeEnum.QUEUE; // QUEUE - 点对点 、 BROADCAST - 广播模式
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toMessage() {
|
||||
return JSONObject.toJSONString(payload);
|
||||
}
|
||||
|
||||
/**
|
||||
* 【!重要配置项!】 构造MQModel , 一般用于发送MQ时
|
||||
**/
|
||||
public static CleanMchLoginAuthCacheMQ build(List<Long> list) {
|
||||
return build(list.stream().map(String::valueOf).collect(Collectors.toList()), CLEAN_CACHE_TYPE_LOGIN_TOKEN);
|
||||
}
|
||||
|
||||
/**
|
||||
* 【!重要配置项!】 构造MQModel , 一般用于发送MQ时
|
||||
**/
|
||||
public static CleanMchLoginAuthCacheMQ build(List<String> list, String cleanCacheType) {
|
||||
return new CleanMchLoginAuthCacheMQ(new MsgPayload(cleanCacheType, list));
|
||||
}
|
||||
|
||||
/**
|
||||
* 解析MQ消息, 一般用于接收MQ消息时
|
||||
**/
|
||||
public static MsgPayload parse(String msg) {
|
||||
return JSON.parseObject(msg, MsgPayload.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* 定义 IMQReceiver 接口: 项目实现该接口则可接收到对应的业务消息
|
||||
**/
|
||||
public interface IMQReceiver {
|
||||
void receive(MsgPayload payload);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
package com.jeequan.jeepay.components.mq.model;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.jeequan.jeepay.components.mq.constant.MQSendTypeEnum;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
*
|
||||
* 定义MQ消息格式
|
||||
* 业务场景: [ 清空所有T+N日期缓存 ]
|
||||
*
|
||||
* @author zx
|
||||
* @date 2023/9/22 15:25
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class CleanTnDayCacheMQ extends AbstractMQ {
|
||||
|
||||
/** 【!重要配置项!】 定义MQ名称 **/
|
||||
public static final String MQ_NAME = "BROADCAST_CLEAN_TN_DAY_CACHE";
|
||||
|
||||
/** 内置msg 消息体定义 **/
|
||||
private MsgPayload payload;
|
||||
|
||||
/** 【!重要配置项!】 定义Msg消息载体 **/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
public static class MsgPayload {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMQName() {
|
||||
return MQ_NAME;
|
||||
}
|
||||
|
||||
/** 【!重要配置项!】 **/
|
||||
@Override
|
||||
public MQSendTypeEnum getMQType(){
|
||||
return MQSendTypeEnum.BROADCAST; // QUEUE - 点对点 、 BROADCAST - 广播模式
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toMessage() {
|
||||
return JSONObject.toJSONString(payload);
|
||||
}
|
||||
|
||||
/** 【!重要配置项!】 构造MQModel , 一般用于发送MQ时 **/
|
||||
public static CleanTnDayCacheMQ build(){
|
||||
return new CleanTnDayCacheMQ(new MsgPayload());
|
||||
}
|
||||
|
||||
/** 解析MQ消息, 一般用于接收MQ消息时 **/
|
||||
public static MsgPayload parse(){
|
||||
return new MsgPayload();
|
||||
}
|
||||
|
||||
/** 定义 IMQReceiver 接口: 项目实现该接口则可接收到对应的业务消息 **/
|
||||
public interface IMQReceiver{
|
||||
void receive(MsgPayload payload);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
package com.jeequan.jeepay.components.mq.model;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.jeequan.jeepay.components.mq.constant.MQSendTypeEnum;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class MchAuditMQ extends AbstractMQ {
|
||||
|
||||
public interface IMQReceiver {
|
||||
void receive(MchAuditMQ.MsgPayload payload);
|
||||
}
|
||||
|
||||
public static final String MQ_NAME = "QUEUE_MCH_AUDIT";
|
||||
|
||||
/** 内置msg 消息体定义 **/
|
||||
private MsgPayload payload;
|
||||
|
||||
/** 【!重要配置项!】 定义Msg消息载体 **/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
public static class MsgPayload {
|
||||
|
||||
/** 商户编号 / 进件号 **/
|
||||
private String applyId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMQName() {
|
||||
return MQ_NAME;
|
||||
}
|
||||
|
||||
@Override
|
||||
public MQSendTypeEnum getMQType() {
|
||||
return MQSendTypeEnum.QUEUE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toMessage() {
|
||||
return JSONObject.toJSONString(payload);
|
||||
}
|
||||
|
||||
/** 解析MQ消息, 一般用于接收MQ消息时 **/
|
||||
public static MsgPayload parse(String msg){
|
||||
return JSON.parseObject(msg, MsgPayload.class);
|
||||
}
|
||||
|
||||
public static MchAuditMQ build(String applyId){
|
||||
return new MchAuditMQ(new MsgPayload(applyId));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
package com.jeequan.jeepay.components.mq.model;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.jeequan.jeepay.components.mq.constant.MQSendTypeEnum;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* 部分通道的回调来自其他的系统,使用rabbitmq做通知转发
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class MchAuditNotifyMQ extends AbstractMQ {
|
||||
|
||||
public interface IMQReceiver {
|
||||
void receive(MchAuditNotifyMQ.MsgPayload payload);
|
||||
}
|
||||
|
||||
public static final String MQ_NAME = "QUEUE_MCH_AUDIT_NOTIFY";
|
||||
|
||||
/** 内置msg 消息体定义 **/
|
||||
private MsgPayload payload;
|
||||
|
||||
/** 【!重要配置项!】 定义Msg消息载体 **/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
public static class MsgPayload {
|
||||
|
||||
private JSONObject notifyData;
|
||||
|
||||
private String ifCode;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMQName() {
|
||||
return MQ_NAME;
|
||||
}
|
||||
|
||||
@Override
|
||||
public MQSendTypeEnum getMQType() {
|
||||
return MQSendTypeEnum.QUEUE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toMessage() {
|
||||
return JSONObject.toJSONString(payload);
|
||||
}
|
||||
|
||||
/** 解析MQ消息, 一般用于接收MQ消息时 **/
|
||||
public static MsgPayload parse(String msg){
|
||||
return JSON.parseObject(msg, MsgPayload.class);
|
||||
}
|
||||
|
||||
public static MchAuditNotifyMQ build(String notifyData){
|
||||
return new MchAuditNotifyMQ(parse(notifyData));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
package com.jeequan.jeepay.components.mq.model;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.jeequan.jeepay.components.mq.constant.MQSendTypeEnum;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* 进件审核结果下发给下游服务商系统
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class MchAuditThirdNotifyMQ extends AbstractMQ {
|
||||
|
||||
public interface IMQReceiver {
|
||||
void receive(MchAuditThirdNotifyMQ.MsgPayload payload);
|
||||
}
|
||||
|
||||
public static final String MQ_NAME = "QUEUE_MCH_THIRD_AUDIT_NOTIFY";
|
||||
|
||||
public static final int TYPE_AUDIT = 1;
|
||||
|
||||
public static final int TYPE_AUDIT_MODIFY = 2;
|
||||
|
||||
/** 内置msg 消息体定义 **/
|
||||
private MsgPayload payload;
|
||||
|
||||
/** 【!重要配置项!】 定义Msg消息载体 **/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
public static class MsgPayload {
|
||||
|
||||
private String applyId;
|
||||
|
||||
/**
|
||||
* 1、进件;2、商户信息变更
|
||||
*/
|
||||
private int type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMQName() {
|
||||
return MQ_NAME;
|
||||
}
|
||||
|
||||
@Override
|
||||
public MQSendTypeEnum getMQType() {
|
||||
return MQSendTypeEnum.QUEUE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toMessage() {
|
||||
return JSONObject.toJSONString(payload);
|
||||
}
|
||||
|
||||
/** 解析MQ消息, 一般用于接收MQ消息时 **/
|
||||
public static MsgPayload parse(String msg){
|
||||
return JSON.parseObject(msg, MsgPayload.class);
|
||||
}
|
||||
|
||||
/** 【!重要配置项!】 构造MQModel , 一般用于发送MQ时 **/
|
||||
public static MchAuditThirdNotifyMQ build(String applyId, int type){
|
||||
return new MchAuditThirdNotifyMQ(new MchAuditThirdNotifyMQ.MsgPayload(applyId, type));
|
||||
}
|
||||
|
||||
public static MchAuditThirdNotifyMQ build(String notifyData){
|
||||
return new MchAuditThirdNotifyMQ(parse(notifyData));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
package com.jeequan.jeepay.components.mq.model;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.jeequan.jeepay.components.mq.constant.MQSendTypeEnum;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
*
|
||||
* 定义MQ消息格式
|
||||
* 业务场景: 订单支付成功自动提现
|
||||
*
|
||||
* @author zx
|
||||
* @date 2021/7/22 15:25
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class PayOrderCashoutMQ extends AbstractMQ {
|
||||
|
||||
/** 【!重要配置项!】 定义MQ名称 **/
|
||||
public static final String MQ_NAME = "QUEUE_PAY_ORDER_CASHOUT";
|
||||
|
||||
/** 内置msg 消息体定义 **/
|
||||
private MsgPayload payload;
|
||||
|
||||
/** 【!重要配置项!】 定义Msg消息载体 **/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
public static class MsgPayload {
|
||||
|
||||
/** 支付订单号 **/
|
||||
private String payOrderId;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMQName() {
|
||||
return MQ_NAME;
|
||||
}
|
||||
|
||||
/** 【!重要配置项!】 **/
|
||||
@Override
|
||||
public MQSendTypeEnum getMQType(){
|
||||
return MQSendTypeEnum.QUEUE; // QUEUE - 点对点 、 BROADCAST - 广播模式
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toMessage() {
|
||||
return JSONObject.toJSONString(payload);
|
||||
}
|
||||
|
||||
/** 【!重要配置项!】 构造MQModel , 一般用于发送MQ时 **/
|
||||
public static PayOrderCashoutMQ build(String payOrderId){
|
||||
return new PayOrderCashoutMQ(new MsgPayload(payOrderId));
|
||||
}
|
||||
|
||||
/** 解析MQ消息, 一般用于接收MQ消息时 **/
|
||||
public static MsgPayload parse(String msg){
|
||||
return JSON.parseObject(msg, MsgPayload.class);
|
||||
}
|
||||
|
||||
/** 定义 IMQReceiver 接口: 项目实现该接口则可接收到对应的业务消息 **/
|
||||
public interface IMQReceiver{
|
||||
void receive(MsgPayload payload);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,122 @@
|
||||
package com.jeequan.jeepay.components.mq.model;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.jeequan.jeepay.components.mq.constant.MQSendTypeEnum;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
* 定义MQ消息格式
|
||||
* 业务场景: [ 支付订单的订单分账消息 ]
|
||||
*
|
||||
* @author terrfly
|
||||
* @date 2021/8/22 11:25
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class PayOrderDivisionMQ extends AbstractMQ {
|
||||
|
||||
/** 【!重要配置项!】 定义MQ名称 **/
|
||||
public static final String MQ_NAME = "QUEUE_PAY_ORDER_DIVISION";
|
||||
|
||||
/** 内置msg 消息体定义 **/
|
||||
private MsgPayload payload;
|
||||
|
||||
/** 【!重要配置项!】 定义Msg消息载体 **/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
public static class MsgPayload {
|
||||
|
||||
/** 支付订单号 **/
|
||||
private String payOrderId;
|
||||
|
||||
/** 是否使用默认分组 **/
|
||||
private Byte useSysAutoDivisionReceivers;
|
||||
|
||||
/**
|
||||
* 分账接受者列表, 字段值为空表示系统默认配置项。
|
||||
* 格式:{receiverId: '1001', receiverGroupId: '1001', divisionProfit: '0.1'}
|
||||
* divisionProfit: 空表示使用系统默认比例。
|
||||
* **/
|
||||
private List<CustomerDivisionReceiver> receiverList;
|
||||
|
||||
/** 是否重新发送 ( 如分账失败,重新请求分账接口 ) , 空表示false **/
|
||||
private Boolean isResend;
|
||||
|
||||
/** 是否重新计算分账金额,比如盛付通第二天再发起分账并且产出了退款的情况(仅当isResend=true时生效) , 空表示false **/
|
||||
private Boolean isResendAndRecalAmount;
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMQName() {
|
||||
return MQ_NAME;
|
||||
}
|
||||
|
||||
/** 【!重要配置项!】 **/
|
||||
@Override
|
||||
public MQSendTypeEnum getMQType(){
|
||||
return MQSendTypeEnum.QUEUE; // QUEUE - 点对点 、 BROADCAST - 广播模式
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toMessage() {
|
||||
return JSONObject.toJSONString(payload);
|
||||
}
|
||||
|
||||
/** 【!重要配置项!】 构造MQModel , 一般用于发送MQ时 **/
|
||||
public static PayOrderDivisionMQ build(String payOrderId, Byte useSysAutoDivisionReceivers, List<CustomerDivisionReceiver> receiverList, Boolean isResend, Boolean isResendAndRecalAmount){
|
||||
return new PayOrderDivisionMQ(new MsgPayload(payOrderId, useSysAutoDivisionReceivers, receiverList, isResend, isResendAndRecalAmount));
|
||||
}
|
||||
|
||||
/** 解析MQ消息, 一般用于接收MQ消息时 **/
|
||||
public static MsgPayload parse(String msg){
|
||||
return JSON.parseObject(msg, MsgPayload.class);
|
||||
}
|
||||
|
||||
/** 定义 IMQReceiver 接口: 项目实现该接口则可接收到对应的业务消息 **/
|
||||
public interface IMQReceiver{
|
||||
void receive(MsgPayload payload);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/** 自定义定义接收账号定义信息 **/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
public static class CustomerDivisionReceiver {
|
||||
|
||||
/**
|
||||
* 分账接收者ID (与receiverGroupId 二选一)
|
||||
*/
|
||||
private Long receiverId;
|
||||
|
||||
/**
|
||||
* 组ID(便于商户接口使用) (与 receiverId 二选一)
|
||||
*/
|
||||
private Long receiverGroupId;
|
||||
|
||||
/**
|
||||
* 分账比例 (可以为空, 为空表示使用系统默认值)
|
||||
*/
|
||||
private BigDecimal divisionProfit;
|
||||
|
||||
/**
|
||||
* 分账金额 (与divisionProfit 二选一)
|
||||
*/
|
||||
private Long divisionAmount;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
package com.jeequan.jeepay.components.mq.model;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.jeequan.jeepay.components.mq.constant.MQSendTypeEnum;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* TODO
|
||||
*
|
||||
* @author crystal
|
||||
* @date 2024/1/29 16:11
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class PayOrderMarketMQ extends AbstractMQ{
|
||||
|
||||
/**
|
||||
* 红包
|
||||
*/
|
||||
public static final byte RED_TYPE = 1;
|
||||
|
||||
/**
|
||||
* 提现手续费
|
||||
*/
|
||||
public static final byte CASH_FEE_TYPE = 2;
|
||||
|
||||
/** 【!重要配置项!】 定义MQ名称 **/
|
||||
public static final String MQ_NAME = "QUEUE_PAY_ORDER_MARKET";
|
||||
|
||||
/** 内置msg 消息体定义 **/
|
||||
private PayOrderMarketMQ.MsgPayload payload;
|
||||
|
||||
/** 【!重要配置项!】 定义Msg消息载体 **/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
public static class MsgPayload {
|
||||
/** id **/
|
||||
private String transferId;
|
||||
|
||||
private Byte type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMQName() {
|
||||
return MQ_NAME;
|
||||
}
|
||||
|
||||
@Override
|
||||
public MQSendTypeEnum getMQType() {
|
||||
return MQSendTypeEnum.QUEUE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toMessage() {
|
||||
return JSONObject.toJSONString(payload);
|
||||
}
|
||||
|
||||
|
||||
/** 【!重要配置项!】 构造MQModel , 一般用于发送MQ时 **/
|
||||
public static PayOrderMarketMQ build(String transferId,Byte type){
|
||||
return new PayOrderMarketMQ(new PayOrderMarketMQ.MsgPayload(transferId,type));
|
||||
}
|
||||
|
||||
/** 解析MQ消息, 一般用于接收MQ消息时 **/
|
||||
public static PayOrderMarketMQ.MsgPayload parse(String msg){
|
||||
return JSON.parseObject(msg, PayOrderMarketMQ.MsgPayload.class);
|
||||
}
|
||||
|
||||
/** 定义 IMQReceiver 接口: 项目实现该接口则可接收到对应的业务消息 **/
|
||||
public interface IMQReceiver{
|
||||
void receive(PayOrderMarketMQ.MsgPayload payload);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
package com.jeequan.jeepay.components.mq.model;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.jeequan.jeepay.components.mq.constant.MQSendTypeEnum;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
*
|
||||
* 定义MQ消息格式
|
||||
* 业务场景: [ 支付订单的商户通知消息 ]
|
||||
*
|
||||
* @author terrfly
|
||||
* @date 2021/7/22 15:25
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class PayOrderMchNotifyMQ extends AbstractMQ {
|
||||
|
||||
/** 【!重要配置项!】 定义MQ名称 **/
|
||||
public static final String MQ_NAME = "QUEUE_PAY_ORDER_MCH_NOTIFY";
|
||||
|
||||
/** 内置msg 消息体定义 **/
|
||||
private MsgPayload payload;
|
||||
|
||||
/** 【!重要配置项!】 定义Msg消息载体 **/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
public static class MsgPayload {
|
||||
|
||||
/** 通知单号 **/
|
||||
private Long notifyId;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMQName() {
|
||||
return MQ_NAME;
|
||||
}
|
||||
|
||||
/** 【!重要配置项!】 **/
|
||||
@Override
|
||||
public MQSendTypeEnum getMQType(){
|
||||
return MQSendTypeEnum.QUEUE; // QUEUE - 点对点 、 BROADCAST - 广播模式
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toMessage() {
|
||||
return JSONObject.toJSONString(payload);
|
||||
}
|
||||
|
||||
/** 【!重要配置项!】 构造MQModel , 一般用于发送MQ时 **/
|
||||
public static PayOrderMchNotifyMQ build(Long notifyId){
|
||||
return new PayOrderMchNotifyMQ(new MsgPayload(notifyId));
|
||||
}
|
||||
|
||||
/** 解析MQ消息, 一般用于接收MQ消息时 **/
|
||||
public static MsgPayload parse(String msg){
|
||||
return JSON.parseObject(msg, MsgPayload.class);
|
||||
}
|
||||
|
||||
/** 定义 IMQReceiver 接口: 项目实现该接口则可接收到对应的业务消息 **/
|
||||
public interface IMQReceiver{
|
||||
void receive(MsgPayload payload);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
package com.jeequan.jeepay.components.mq.model;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.jeequan.jeepay.components.mq.constant.MQSendTypeEnum;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
*
|
||||
* 定义MQ消息格式
|
||||
* 业务场景: [ 支付订单补单(一般用于没有回调的接口,比如微信的条码支付) ]
|
||||
*
|
||||
* @author terrfly
|
||||
* @date 2021/7/22 15:25
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class PayOrderReissueMQ extends AbstractMQ {
|
||||
|
||||
/** 【!重要配置项!】 定义MQ名称 **/
|
||||
public static final String MQ_NAME = "QUEUE_PAY_ORDER_REISSUE";
|
||||
|
||||
/** 内置msg 消息体定义 **/
|
||||
private MsgPayload payload;
|
||||
|
||||
/** 【!重要配置项!】 定义Msg消息载体 **/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
public static class MsgPayload {
|
||||
|
||||
/** 支付订单号 **/
|
||||
private String payOrderId;
|
||||
|
||||
/** 通知次数 **/
|
||||
private Integer count;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMQName() {
|
||||
return MQ_NAME;
|
||||
}
|
||||
|
||||
/** 【!重要配置项!】 **/
|
||||
@Override
|
||||
public MQSendTypeEnum getMQType(){
|
||||
return MQSendTypeEnum.QUEUE; // QUEUE - 点对点 、 BROADCAST - 广播模式
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toMessage() {
|
||||
return JSONObject.toJSONString(payload);
|
||||
}
|
||||
|
||||
/** 【!重要配置项!】 构造MQModel , 一般用于发送MQ时 **/
|
||||
public static PayOrderReissueMQ build(String payOrderId, Integer count){
|
||||
return new PayOrderReissueMQ(new MsgPayload(payOrderId, count));
|
||||
}
|
||||
|
||||
/** 解析MQ消息, 一般用于接收MQ消息时 **/
|
||||
public static MsgPayload parse(String msg){
|
||||
return JSON.parseObject(msg, MsgPayload.class);
|
||||
}
|
||||
|
||||
/** 定义 IMQReceiver 接口: 项目实现该接口则可接收到对应的业务消息 **/
|
||||
public interface IMQReceiver{
|
||||
void receive(MsgPayload payload);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
package com.jeequan.jeepay.components.mq.model;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.jeequan.jeepay.components.mq.constant.MQSendTypeEnum;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
*
|
||||
* 定义MQ消息格式
|
||||
* 业务场景: 云打印 [ 新订单提醒 ]
|
||||
*
|
||||
* @author zx
|
||||
* @date 2021/01/04 15:25
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class PushPrinterMQ extends AbstractMQ {
|
||||
|
||||
/** 【!重要配置项!】 定义MQ名称 **/
|
||||
public static final String MQ_NAME = "QUEUE_PUSH_PRINTER";
|
||||
|
||||
/** 内置msg 消息体定义 **/
|
||||
private MsgPayload payload;
|
||||
|
||||
/** 【!重要配置项!】 定义Msg消息载体 **/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
public static class MsgPayload {
|
||||
|
||||
public static Byte ORDER_TYPE_PAY = 1; // 支付订单
|
||||
public static Byte ORDER_TYPE_MEMBER = 2; // 会员余额支付流水ID
|
||||
|
||||
/** 支付订单号 或 会员支付流水记录ID(用于会员余额支付) **/
|
||||
private String orderId;
|
||||
|
||||
/** 订单类型,1-支付订单,2-会员余额支付流水ID **/
|
||||
private Byte orderType;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMQName() {
|
||||
return MQ_NAME;
|
||||
}
|
||||
|
||||
/** 【!重要配置项!】 **/
|
||||
@Override
|
||||
public MQSendTypeEnum getMQType(){
|
||||
return MQSendTypeEnum.QUEUE; // QUEUE - 点对点 、 BROADCAST - 广播模式
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toMessage() {
|
||||
return JSONObject.toJSONString(payload);
|
||||
}
|
||||
|
||||
/** 【!重要配置项!】 构造MQModel , 一般用于发送MQ时 **/
|
||||
public static PushPrinterMQ build(String orderId, Byte orderType){
|
||||
return new PushPrinterMQ(new MsgPayload(orderId, orderType));
|
||||
}
|
||||
|
||||
/** 解析MQ消息, 一般用于接收MQ消息时 **/
|
||||
public static MsgPayload parse(String msg){
|
||||
return JSON.parseObject(msg, MsgPayload.class);
|
||||
}
|
||||
|
||||
/** 定义 IMQReceiver 接口: 项目实现该接口则可接收到对应的业务消息 **/
|
||||
public interface IMQReceiver{
|
||||
void receive(MsgPayload payload);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
package com.jeequan.jeepay.components.mq.model;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.jeequan.jeepay.components.mq.constant.MQSendTypeEnum;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
*
|
||||
* 定义MQ消息格式
|
||||
* 业务场景: 云喇叭 [ 新订单提醒 ]
|
||||
*
|
||||
* @author zx
|
||||
* @date 2021/01/04 15:25
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class PushSpeakerMQ extends AbstractMQ {
|
||||
|
||||
/** 【!重要配置项!】 定义MQ名称 **/
|
||||
public static final String MQ_NAME = "QUEUE_PUSH_SPEAKER";
|
||||
|
||||
/** 内置msg 消息体定义 **/
|
||||
private MsgPayload payload;
|
||||
|
||||
/** 【!重要配置项!】 定义Msg消息载体 **/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
public static class MsgPayload {
|
||||
|
||||
public static byte ORDER_TYPE_PAY = 1; // 支付订单
|
||||
public static byte ORDER_TYPE_MEMBER = 2; // 会员余额支付流水ID
|
||||
|
||||
/** 支付订单号 或 会员支付流水记录ID(用于会员余额支付) **/
|
||||
private String orderId;
|
||||
|
||||
/** 订单类型,1-支付订单,2-会员余额支付流水ID **/
|
||||
private Byte orderType;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMQName() {
|
||||
return MQ_NAME;
|
||||
}
|
||||
|
||||
/** 【!重要配置项!】 **/
|
||||
@Override
|
||||
public MQSendTypeEnum getMQType(){
|
||||
return MQSendTypeEnum.QUEUE; // QUEUE - 点对点 、 BROADCAST - 广播模式
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toMessage() {
|
||||
return JSONObject.toJSONString(payload);
|
||||
}
|
||||
|
||||
/** 【!重要配置项!】 构造MQModel , 一般用于发送MQ时 **/
|
||||
public static PushSpeakerMQ build(String orderId, Byte orderType){
|
||||
return new PushSpeakerMQ(new MsgPayload(orderId, orderType));
|
||||
}
|
||||
|
||||
/** 解析MQ消息, 一般用于接收MQ消息时 **/
|
||||
public static MsgPayload parse(String msg){
|
||||
return JSON.parseObject(msg, MsgPayload.class);
|
||||
}
|
||||
|
||||
/** 定义 IMQReceiver 接口: 项目实现该接口则可接收到对应的业务消息 **/
|
||||
public interface IMQReceiver{
|
||||
void receive(MsgPayload payload);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
package com.jeequan.jeepay.components.mq.model;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.jeequan.jeepay.components.mq.constant.MQSendTypeEnum;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
*
|
||||
* 定义MQ消息格式
|
||||
* 业务场景:微信公众号消息 [ 新订单提醒 ]
|
||||
*
|
||||
* @author zx
|
||||
* @date 2021/01/04 15:25
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class PushWxMpMsgMQ extends AbstractMQ {
|
||||
|
||||
/** 【!重要配置项!】 定义MQ名称 **/
|
||||
public static final String MQ_NAME = "QUEUE_PUSH_WX_MP_MSG";
|
||||
|
||||
/**
|
||||
* 订单通知
|
||||
*/
|
||||
public static final byte ORDER_NOTICE = 1;
|
||||
|
||||
/**
|
||||
* 路由通知
|
||||
*/
|
||||
public static final byte ROUTE_NOTICE = 2;
|
||||
|
||||
/** 内置msg 消息体定义 **/
|
||||
private MsgPayload payload;
|
||||
|
||||
/** 【!重要配置项!】 定义Msg消息载体 **/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
public static class MsgPayload {
|
||||
|
||||
/** 支付订单号 **/
|
||||
private String payOrderId;
|
||||
|
||||
/**
|
||||
* 通知类型
|
||||
*/
|
||||
private Byte noticeType;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMQName() {
|
||||
return MQ_NAME;
|
||||
}
|
||||
|
||||
/** 【!重要配置项!】 **/
|
||||
@Override
|
||||
public MQSendTypeEnum getMQType(){
|
||||
return MQSendTypeEnum.QUEUE; // QUEUE - 点对点 、 BROADCAST - 广播模式
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toMessage() {
|
||||
return JSONObject.toJSONString(payload);
|
||||
}
|
||||
|
||||
/** 【!重要配置项!】 构造MQModel , 一般用于发送MQ时 **/
|
||||
public static PushWxMpMsgMQ build(String payOrderId,byte noticeType){
|
||||
return new PushWxMpMsgMQ(new MsgPayload(payOrderId,noticeType));
|
||||
}
|
||||
|
||||
/** 解析MQ消息, 一般用于接收MQ消息时 **/
|
||||
public static MsgPayload parse(String msg){
|
||||
return JSON.parseObject(msg, MsgPayload.class);
|
||||
}
|
||||
|
||||
/** 定义 IMQReceiver 接口: 项目实现该接口则可接收到对应的业务消息 **/
|
||||
public interface IMQReceiver{
|
||||
void receive(MsgPayload payload);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
package com.jeequan.jeepay.components.mq.model;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.jeequan.jeepay.components.mq.constant.MQSendTypeEnum;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
*
|
||||
* 定义MQ消息格式
|
||||
* 业务场景: [ 更新系统配置参数 ]
|
||||
*
|
||||
* @author terrfly
|
||||
* @date 2021/7/22 15:25
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class ResetAppConfigMQ extends AbstractMQ {
|
||||
|
||||
/** 【!重要配置项!】 定义MQ名称 **/
|
||||
public static final String MQ_NAME = "BROADCAST_RESET_APP_CONFIG";
|
||||
|
||||
/** 内置msg 消息体定义 **/
|
||||
private MsgPayload payload;
|
||||
|
||||
/** 【!重要配置项!】 定义Msg消息载体 **/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
public static class MsgPayload {
|
||||
|
||||
private String groupKey;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMQName() {
|
||||
return MQ_NAME;
|
||||
}
|
||||
|
||||
/** 【!重要配置项!】 **/
|
||||
@Override
|
||||
public MQSendTypeEnum getMQType(){
|
||||
return MQSendTypeEnum.BROADCAST; // QUEUE - 点对点 、 BROADCAST - 广播模式
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toMessage() {
|
||||
return JSONObject.toJSONString(payload);
|
||||
}
|
||||
|
||||
/** 【!重要配置项!】 构造MQModel , 一般用于发送MQ时 **/
|
||||
public static ResetAppConfigMQ build(String groupKey){
|
||||
return new ResetAppConfigMQ(new MsgPayload(groupKey));
|
||||
}
|
||||
|
||||
/** 解析MQ消息, 一般用于接收MQ消息时 **/
|
||||
public static MsgPayload parse(String msg){
|
||||
return JSON.parseObject(msg, MsgPayload.class);
|
||||
}
|
||||
|
||||
/** 定义 IMQReceiver 接口: 项目实现该接口则可接收到对应的业务消息 **/
|
||||
public interface IMQReceiver{
|
||||
void receive(MsgPayload payload);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
package com.jeequan.jeepay.components.mq.model;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.jeequan.jeepay.components.mq.constant.MQSendTypeEnum;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
*
|
||||
* 定义MQ消息格式
|
||||
* 业务场景: [ 更新服务商/商户/商户应用配置信息 ]
|
||||
*
|
||||
* @author terrfly
|
||||
* @date 2021/7/22 15:25
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class ResetIsvMchAppInfoConfigMQ extends AbstractMQ {
|
||||
|
||||
/** 【!重要配置项!】 定义MQ名称 **/
|
||||
public static final String MQ_NAME = "BROADCAST_RESET_ISV_MCH_APP_INFO_CONFIG";
|
||||
|
||||
/** 内置msg 消息体定义 **/
|
||||
private MsgPayload payload;
|
||||
|
||||
// 重置类型 (枚举类型,无法json反序列化)
|
||||
public static final byte RESET_TYPE_ISV_INFO = 1;
|
||||
public static final byte RESET_TYPE_MCH_INFO = 2;
|
||||
public static final byte RESET_TYPE_MCH_APP = 3;
|
||||
|
||||
/** 【!重要配置项!】 定义Msg消息载体 **/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
public static class MsgPayload {
|
||||
|
||||
/** 重置类型 **/
|
||||
private Byte resetType;
|
||||
|
||||
/** isvNo **/
|
||||
private String isvNo;
|
||||
|
||||
/** mchNo **/
|
||||
private String mchNo;
|
||||
|
||||
/** appId **/
|
||||
private String appId;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getMQName() {
|
||||
return MQ_NAME;
|
||||
}
|
||||
|
||||
/** 【!重要配置项!】 **/
|
||||
@Override
|
||||
public MQSendTypeEnum getMQType(){
|
||||
return MQSendTypeEnum.BROADCAST; // QUEUE - 点对点 、 BROADCAST - 广播模式
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toMessage() {
|
||||
return JSONObject.toJSONString(payload);
|
||||
}
|
||||
|
||||
/** 【!重要配置项!】 构造MQModel , 一般用于发送MQ时 **/
|
||||
public static ResetIsvMchAppInfoConfigMQ build(Byte resetType, String isvNo, String mchNo, String appId){
|
||||
return new ResetIsvMchAppInfoConfigMQ(new MsgPayload(resetType, isvNo, mchNo, appId));
|
||||
}
|
||||
|
||||
/** 解析MQ消息, 一般用于接收MQ消息时 **/
|
||||
public static MsgPayload parse(String msg){
|
||||
return JSON.parseObject(msg, MsgPayload.class);
|
||||
}
|
||||
|
||||
/** 定义 IMQReceiver 接口: 项目实现该接口则可接收到对应的业务消息 **/
|
||||
public interface IMQReceiver{
|
||||
void receive(MsgPayload payload);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
package com.jeequan.jeepay.components.mq.model;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.jeequan.jeepay.components.mq.constant.MQSendTypeEnum;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
*
|
||||
* 定义MQ消息格式
|
||||
* 业务场景: [ 支付宝直付通订单结算 ]
|
||||
*
|
||||
* @author xiaoyu
|
||||
* @date 2021/7/22 15:25
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class ZftSettOrderMQ extends AbstractMQ {
|
||||
|
||||
/** 【!重要配置项!】 定义MQ名称 **/
|
||||
public static final String MQ_NAME = "QUEUE_SETT_ORDER_MCH";
|
||||
|
||||
/** 内置msg 消息体定义 **/
|
||||
private MsgPayload payload;
|
||||
|
||||
/** 【!重要配置项!】 定义Msg消息载体 **/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
public static class MsgPayload {
|
||||
|
||||
/** 结算记录ID **/
|
||||
private String settRecordId;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMQName() {
|
||||
return MQ_NAME;
|
||||
}
|
||||
|
||||
/** 【!重要配置项!】 **/
|
||||
@Override
|
||||
public MQSendTypeEnum getMQType(){
|
||||
return MQSendTypeEnum.QUEUE; // QUEUE - 点对点 、 BROADCAST - 广播模式
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toMessage() {
|
||||
return JSONObject.toJSONString(payload);
|
||||
}
|
||||
|
||||
/** 【!重要配置项!】 构造MQModel , 一般用于发送MQ时 **/
|
||||
public static ZftSettOrderMQ build(String settRecordId){
|
||||
return new ZftSettOrderMQ(new MsgPayload(settRecordId));
|
||||
}
|
||||
|
||||
/** 解析MQ消息, 一般用于接收MQ消息时 **/
|
||||
public static MsgPayload parse(String msg){
|
||||
return JSON.parseObject(msg, MsgPayload.class);
|
||||
}
|
||||
|
||||
/** 定义 IMQReceiver 接口: 项目实现该接口则可接收到对应的业务消息 **/
|
||||
public interface IMQReceiver{
|
||||
void receive(MsgPayload payload);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.jeequan.jeepay.components.mq.vender;
|
||||
|
||||
/**
|
||||
* MQ 消息接收器 接口定义
|
||||
*
|
||||
* @author terrfly
|
||||
* @date 2021/7/21 16:09
|
||||
*/
|
||||
public interface IMQMsgReceiver {
|
||||
|
||||
/** 接收消息 **/
|
||||
void receiveMsg(String msg);
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.jeequan.jeepay.components.mq.vender;
|
||||
|
||||
import com.jeequan.jeepay.components.mq.model.AbstractMQ;
|
||||
|
||||
/**
|
||||
* MQ 消息发送器 接口定义
|
||||
*
|
||||
* @author terrfly
|
||||
* @date 2021/7/21 16:09
|
||||
*/
|
||||
public interface IMQSender {
|
||||
|
||||
/** 推送MQ消息, 实时 **/
|
||||
void send(AbstractMQ mqModel);
|
||||
|
||||
/** 推送MQ消息, 延迟接收,单位:s **/
|
||||
void send(AbstractMQ mqModel, int delay);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
package com.jeequan.jeepay.components.mq.vender.activemq;
|
||||
|
||||
import com.jeequan.jeepay.components.mq.constant.MQSendTypeEnum;
|
||||
import com.jeequan.jeepay.components.mq.constant.MQVenderCS;
|
||||
import com.jeequan.jeepay.components.mq.model.AbstractMQ;
|
||||
import org.apache.activemq.command.ActiveMQQueue;
|
||||
import org.apache.activemq.command.ActiveMQTopic;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.jms.config.DefaultJmsListenerContainerFactory;
|
||||
import org.springframework.jms.config.JmsListenerContainerFactory;
|
||||
import org.springframework.jms.listener.DefaultMessageListenerContainer;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.jms.ConnectionFactory;
|
||||
import javax.jms.Destination;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
/*
|
||||
* activeMQ的配置项
|
||||
*
|
||||
* @author terrfly
|
||||
* @date 2021/7/23 16:51
|
||||
*/
|
||||
@Component
|
||||
@ConditionalOnProperty(name = MQVenderCS.YML_VENDER_KEY, havingValue = MQVenderCS.ACTIVE_MQ)
|
||||
public class ActiveMQConfig {
|
||||
|
||||
Map<String, Destination> map = new ConcurrentHashMap<>();
|
||||
|
||||
public Destination getDestination(AbstractMQ mqModel){
|
||||
|
||||
if(map.get(mqModel.getMQName()) == null){
|
||||
this.init(mqModel.getMQName(), mqModel.getMQType());
|
||||
}
|
||||
return map.get(mqModel.getMQName());
|
||||
}
|
||||
|
||||
private synchronized void init(String mqName, MQSendTypeEnum mqSendTypeEnum){
|
||||
|
||||
if(mqSendTypeEnum == MQSendTypeEnum.QUEUE){
|
||||
map.put(mqName, new ActiveMQQueue(mqName) );
|
||||
}else{
|
||||
map.put(mqName, new ActiveMQTopic(mqName) );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static final String TOPIC_LISTENER_CONTAINER = "jmsTopicListenerContainer";
|
||||
|
||||
/** 新增jmsListenerContainer, 用于接收topic类型的消息 **/
|
||||
@Bean
|
||||
public JmsListenerContainerFactory<DefaultMessageListenerContainer> jmsTopicListenerContainer(ConnectionFactory factory){
|
||||
DefaultJmsListenerContainerFactory bean = new DefaultJmsListenerContainerFactory();
|
||||
bean.setPubSubDomain(true);
|
||||
bean.setConnectionFactory(factory);
|
||||
return bean;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package com.jeequan.jeepay.components.mq.vender.activemq;
|
||||
|
||||
import com.jeequan.jeepay.components.mq.constant.MQVenderCS;
|
||||
import com.jeequan.jeepay.components.mq.model.AbstractMQ;
|
||||
import com.jeequan.jeepay.components.mq.vender.IMQSender;
|
||||
import org.apache.activemq.ScheduledMessage;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.jms.core.JmsTemplate;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.jms.TextMessage;
|
||||
|
||||
/**
|
||||
* activeMQ 消息发送器的实现
|
||||
*
|
||||
* @author terrfly
|
||||
* @date 2021/7/23 16:52
|
||||
*/
|
||||
@Component
|
||||
@ConditionalOnProperty(name = MQVenderCS.YML_VENDER_KEY, havingValue = MQVenderCS.ACTIVE_MQ)
|
||||
public class ActiveMQSender implements IMQSender {
|
||||
|
||||
@Autowired
|
||||
private ActiveMQConfig activeMQConfig;
|
||||
|
||||
@Autowired
|
||||
private JmsTemplate jmsTemplate;
|
||||
|
||||
@Override
|
||||
public void send(AbstractMQ mqModel) {
|
||||
jmsTemplate.convertAndSend(activeMQConfig.getDestination(mqModel), mqModel.toMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void send(AbstractMQ mqModel, int delay) {
|
||||
jmsTemplate.send(activeMQConfig.getDestination(mqModel), session -> {
|
||||
TextMessage tm = session.createTextMessage(mqModel.toMessage());
|
||||
tm.setLongProperty(ScheduledMessage.AMQ_SCHEDULED_DELAY, delay * 1000);
|
||||
tm.setLongProperty(ScheduledMessage.AMQ_SCHEDULED_PERIOD, 1*1000);
|
||||
tm.setLongProperty(ScheduledMessage.AMQ_SCHEDULED_REPEAT, 1);
|
||||
return tm;
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
/*
|
||||
* <p>
|
||||
* Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0;
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* <p>
|
||||
* http://www.gnu.org/licenses/lgpl.html
|
||||
* <p>
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.jeequan.jeepay.components.mq.vender.activemq.receive;
|
||||
|
||||
import com.jeequan.jeepay.components.mq.constant.MQVenderCS;
|
||||
import com.jeequan.jeepay.components.mq.executor.MqThreadExecutor;
|
||||
import com.jeequan.jeepay.components.mq.model.AccountBalanceMQ;
|
||||
import com.jeequan.jeepay.components.mq.vender.IMQMsgReceiver;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.jms.annotation.JmsListener;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* activeMQ消息接收器:仅在vender=activeMQ时 && 项目实现IMQReceiver接口时 进行实例化
|
||||
* 业务: app推送
|
||||
*
|
||||
* @author terrfly
|
||||
* @date 2021/7/22 17:06
|
||||
*/
|
||||
@Component
|
||||
@ConditionalOnProperty(name = MQVenderCS.YML_VENDER_KEY, havingValue = MQVenderCS.ACTIVE_MQ)
|
||||
@ConditionalOnBean(AccountBalanceMQ.IMQReceiver.class)
|
||||
public class AccountBalanceActiveMQReceiver implements IMQMsgReceiver {
|
||||
|
||||
@Autowired
|
||||
private AccountBalanceMQ.IMQReceiver mqReceiver;
|
||||
|
||||
/** 接收 【 queue 】 类型的消息 **/
|
||||
@Override
|
||||
@Async(MqThreadExecutor.EXECUTOR_PAY_ORDER_MARKET)
|
||||
@JmsListener(destination = AccountBalanceMQ.MQ_NAME)
|
||||
public void receiveMsg(String msg){
|
||||
mqReceiver.receive(AccountBalanceMQ.parse(msg));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.jeequan.jeepay.components.mq.vender.activemq.receive;
|
||||
|
||||
import com.jeequan.jeepay.components.mq.constant.MQVenderCS;
|
||||
import com.jeequan.jeepay.components.mq.executor.MqThreadExecutor;
|
||||
import com.jeequan.jeepay.components.mq.model.AppPushMQ;
|
||||
import com.jeequan.jeepay.components.mq.vender.IMQMsgReceiver;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.jms.annotation.JmsListener;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* activeMQ消息接收器:仅在vender=activeMQ时 && 项目实现IMQReceiver接口时 进行实例化
|
||||
* 业务: app推送
|
||||
*
|
||||
* @author terrfly
|
||||
* @date 2021/7/22 17:06
|
||||
*/
|
||||
@Component
|
||||
@ConditionalOnProperty(name = MQVenderCS.YML_VENDER_KEY, havingValue = MQVenderCS.ACTIVE_MQ)
|
||||
@ConditionalOnBean(AppPushMQ.IMQReceiver.class)
|
||||
public class AppPushActiveMQReceiver implements IMQMsgReceiver {
|
||||
|
||||
@Autowired
|
||||
private AppPushMQ.IMQReceiver mqReceiver;
|
||||
|
||||
/** 接收 【 queue 】 类型的消息 **/
|
||||
@Override
|
||||
@Async(MqThreadExecutor.EXECUTOR_APP_PUSH)
|
||||
@JmsListener(destination = AppPushMQ.MQ_NAME)
|
||||
public void receiveMsg(String msg){
|
||||
mqReceiver.receive(AppPushMQ.parse(msg));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.jeequan.jeepay.components.mq.vender.activemq.receive;
|
||||
|
||||
import com.jeequan.jeepay.components.mq.constant.MQVenderCS;
|
||||
import com.jeequan.jeepay.components.mq.executor.MqThreadExecutor;
|
||||
import com.jeequan.jeepay.components.mq.model.CleanAgentLoginAuthCacheMQ;
|
||||
import com.jeequan.jeepay.components.mq.vender.IMQMsgReceiver;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.jms.annotation.JmsListener;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* activeMQ 消息接收器:仅在vender=activeMQ时 && 项目实现IMQReceiver接口时 进行实例化
|
||||
* 业务: 清除服务商登录信息
|
||||
*
|
||||
* @author terrfly
|
||||
* @date 2021/7/22 17:06
|
||||
*/
|
||||
@Component
|
||||
@ConditionalOnProperty(name = MQVenderCS.YML_VENDER_KEY, havingValue = MQVenderCS.ACTIVE_MQ)
|
||||
@ConditionalOnBean(CleanAgentLoginAuthCacheMQ.IMQReceiver.class)
|
||||
public class CleanAgentLoginAuthCacheActiveMQReceiver implements IMQMsgReceiver {
|
||||
|
||||
@Autowired
|
||||
private CleanAgentLoginAuthCacheMQ.IMQReceiver mqReceiver;
|
||||
|
||||
/** 接收 【 queue 】 类型的消息 **/
|
||||
@Override
|
||||
@Async(MqThreadExecutor.EXECUTOR_COMMON)
|
||||
@JmsListener(destination = CleanAgentLoginAuthCacheMQ.MQ_NAME)
|
||||
public void receiveMsg(String msg){
|
||||
mqReceiver.receive(CleanAgentLoginAuthCacheMQ.parse(msg));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.jeequan.jeepay.components.mq.vender.activemq.receive;
|
||||
|
||||
import com.jeequan.jeepay.components.mq.constant.MQVenderCS;
|
||||
import com.jeequan.jeepay.components.mq.executor.MqThreadExecutor;
|
||||
import com.jeequan.jeepay.components.mq.model.CleanMchLoginAuthCacheMQ;
|
||||
import com.jeequan.jeepay.components.mq.vender.IMQMsgReceiver;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.jms.annotation.JmsListener;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* activeMQ 消息接收器:仅在vender=activeMQ时 && 项目实现IMQReceiver接口时 进行实例化
|
||||
* 业务: 清除商户登录信息
|
||||
*
|
||||
* @author terrfly
|
||||
* @date 2021/7/22 17:06
|
||||
*/
|
||||
@Component
|
||||
@ConditionalOnProperty(name = MQVenderCS.YML_VENDER_KEY, havingValue = MQVenderCS.ACTIVE_MQ)
|
||||
@ConditionalOnBean(CleanMchLoginAuthCacheMQ.IMQReceiver.class)
|
||||
public class CleanMchLoginAuthCacheActiveMQReceiver implements IMQMsgReceiver {
|
||||
|
||||
@Autowired
|
||||
private CleanMchLoginAuthCacheMQ.IMQReceiver mqReceiver;
|
||||
|
||||
/** 接收 【 queue 】 类型的消息 **/
|
||||
@Override
|
||||
@Async(MqThreadExecutor.EXECUTOR_COMMON)
|
||||
@JmsListener(destination = CleanMchLoginAuthCacheMQ.MQ_NAME)
|
||||
public void receiveMsg(String msg){
|
||||
mqReceiver.receive(CleanMchLoginAuthCacheMQ.parse(msg));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.jeequan.jeepay.components.mq.vender.activemq.receive;
|
||||
|
||||
import com.jeequan.jeepay.components.mq.constant.MQVenderCS;
|
||||
import com.jeequan.jeepay.components.mq.executor.MqThreadExecutor;
|
||||
import com.jeequan.jeepay.components.mq.model.MchAuditMQ;
|
||||
import com.jeequan.jeepay.components.mq.vender.IMQMsgReceiver;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.jms.annotation.JmsListener;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
@ConditionalOnProperty(name = MQVenderCS.YML_VENDER_KEY, havingValue = MQVenderCS.ACTIVE_MQ)
|
||||
@ConditionalOnBean(MchAuditMQ.IMQReceiver.class)
|
||||
public class MchAuditActiveMQReceiver implements IMQMsgReceiver {
|
||||
|
||||
@Autowired
|
||||
private MchAuditMQ.IMQReceiver mqReceiver;
|
||||
|
||||
/** 接收 【 queue 】 类型的消息 **/
|
||||
@Override
|
||||
@Async(MqThreadExecutor.EXECUTOR_APP_PUSH)
|
||||
@JmsListener(destination = MchAuditMQ.MQ_NAME)
|
||||
public void receiveMsg(String msg){
|
||||
mqReceiver.receive(MchAuditMQ.parse(msg));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.jeequan.jeepay.components.mq.vender.activemq.receive;
|
||||
|
||||
import com.jeequan.jeepay.components.mq.constant.MQVenderCS;
|
||||
import com.jeequan.jeepay.components.mq.executor.MqThreadExecutor;
|
||||
import com.jeequan.jeepay.components.mq.model.PayOrderCashoutMQ;
|
||||
import com.jeequan.jeepay.components.mq.vender.IMQMsgReceiver;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.jms.annotation.JmsListener;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* activeMQ 消息接收器:仅在vender=activeMQ时 && 项目实现IMQReceiver接口时 进行实例化
|
||||
* 业务:订单支付成功自动提现
|
||||
*
|
||||
* @author zx
|
||||
* @date 2021/7/22 17:06
|
||||
*/
|
||||
@Component
|
||||
@ConditionalOnProperty(name = MQVenderCS.YML_VENDER_KEY, havingValue = MQVenderCS.ACTIVE_MQ)
|
||||
@ConditionalOnBean(PayOrderCashoutMQ.IMQReceiver.class)
|
||||
public class PayOrderCashoutActiveMQReceiver implements IMQMsgReceiver {
|
||||
|
||||
@Autowired
|
||||
private PayOrderCashoutMQ.IMQReceiver mqReceiver;
|
||||
|
||||
/** 接收 【 queue 】 类型的消息 **/
|
||||
@Override
|
||||
@Async(MqThreadExecutor.EXECUTOR_PAY_ORDER_CASHOUT)
|
||||
@JmsListener(destination = PayOrderCashoutMQ.MQ_NAME)
|
||||
public void receiveMsg(String msg){
|
||||
mqReceiver.receive(PayOrderCashoutMQ.parse(msg));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.jeequan.jeepay.components.mq.vender.activemq.receive;
|
||||
|
||||
import com.jeequan.jeepay.components.mq.constant.MQVenderCS;
|
||||
import com.jeequan.jeepay.components.mq.executor.MqThreadExecutor;
|
||||
import com.jeequan.jeepay.components.mq.model.PayOrderDivisionMQ;
|
||||
import com.jeequan.jeepay.components.mq.vender.IMQMsgReceiver;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.jms.annotation.JmsListener;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* activeMQ 消息接收器:仅在vender=activeMQ时 && 项目实现IMQReceiver接口时 进行实例化
|
||||
* 业务: 支付订单分账通知
|
||||
*
|
||||
* @author terrfly
|
||||
* @date 2021/8/22 16:43
|
||||
*/
|
||||
@Component
|
||||
@ConditionalOnProperty(name = MQVenderCS.YML_VENDER_KEY, havingValue = MQVenderCS.ACTIVE_MQ)
|
||||
@ConditionalOnBean(PayOrderDivisionMQ.IMQReceiver.class)
|
||||
public class PayOrderDivisionActiveMQReceiver implements IMQMsgReceiver {
|
||||
|
||||
@Autowired
|
||||
private PayOrderDivisionMQ.IMQReceiver mqReceiver;
|
||||
|
||||
/** 接收 【 queue 】 类型的消息 **/
|
||||
@Override
|
||||
@Async(MqThreadExecutor.EXECUTOR_PAY_ORDER_DIVISION)
|
||||
@JmsListener(destination = PayOrderDivisionMQ.MQ_NAME)
|
||||
public void receiveMsg(String msg){
|
||||
mqReceiver.receive(PayOrderDivisionMQ.parse(msg));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package com.jeequan.jeepay.components.mq.vender.activemq.receive;
|
||||
|
||||
import com.jeequan.jeepay.components.mq.constant.MQVenderCS;
|
||||
import com.jeequan.jeepay.components.mq.executor.MqThreadExecutor;
|
||||
import com.jeequan.jeepay.components.mq.model.AccountBalanceMQ;
|
||||
import com.jeequan.jeepay.components.mq.model.PayOrderMarketMQ;
|
||||
import com.jeequan.jeepay.components.mq.vender.IMQMsgReceiver;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.jms.annotation.JmsListener;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* TODO
|
||||
*
|
||||
* @author crystal
|
||||
* @date 2024/1/29 16:18
|
||||
*/
|
||||
@Component
|
||||
@ConditionalOnProperty(name = MQVenderCS.YML_VENDER_KEY, havingValue = MQVenderCS.ACTIVE_MQ)
|
||||
@ConditionalOnBean(PayOrderMarketMQ.IMQReceiver.class)
|
||||
public class PayOrderMarketActiveMQReceiver implements IMQMsgReceiver {
|
||||
|
||||
@Autowired
|
||||
private PayOrderMarketMQ.IMQReceiver mqReceiver;
|
||||
|
||||
/** 接收 【 queue 】 类型的消息 **/
|
||||
@Override
|
||||
@Async(MqThreadExecutor.EXECUTOR_ACCOUNT_BALANCE)
|
||||
@JmsListener(destination = PayOrderMarketMQ.MQ_NAME)
|
||||
public void receiveMsg(String msg){
|
||||
mqReceiver.receive(PayOrderMarketMQ.parse(msg));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.jeequan.jeepay.components.mq.vender.activemq.receive;
|
||||
|
||||
import com.jeequan.jeepay.components.mq.constant.MQVenderCS;
|
||||
import com.jeequan.jeepay.components.mq.executor.MqThreadExecutor;
|
||||
import com.jeequan.jeepay.components.mq.model.PayOrderMchNotifyMQ;
|
||||
import com.jeequan.jeepay.components.mq.vender.IMQMsgReceiver;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.jms.annotation.JmsListener;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* activeMQ 消息接收器:仅在vender=activeMQ时 && 项目实现IMQReceiver接口时 进行实例化
|
||||
* 业务: 支付订单商户通知
|
||||
*
|
||||
* @author terrfly
|
||||
* @date 2021/7/22 17:06
|
||||
*/
|
||||
@Component
|
||||
@ConditionalOnProperty(name = MQVenderCS.YML_VENDER_KEY, havingValue = MQVenderCS.ACTIVE_MQ)
|
||||
@ConditionalOnBean(PayOrderMchNotifyMQ.IMQReceiver.class)
|
||||
public class PayOrderMchNotifyActiveMQReceiver implements IMQMsgReceiver {
|
||||
|
||||
@Autowired
|
||||
private PayOrderMchNotifyMQ.IMQReceiver mqReceiver;
|
||||
|
||||
/** 接收 【 queue 】 类型的消息 **/
|
||||
@Override
|
||||
@Async(MqThreadExecutor.EXECUTOR_PAY_ORDER_MCH_NOTIFY)
|
||||
@JmsListener(destination = PayOrderMchNotifyMQ.MQ_NAME)
|
||||
public void receiveMsg(String msg){
|
||||
mqReceiver.receive(PayOrderMchNotifyMQ.parse(msg));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.jeequan.jeepay.components.mq.vender.activemq.receive;
|
||||
|
||||
import com.jeequan.jeepay.components.mq.constant.MQVenderCS;
|
||||
import com.jeequan.jeepay.components.mq.executor.MqThreadExecutor;
|
||||
import com.jeequan.jeepay.components.mq.model.PayOrderReissueMQ;
|
||||
import com.jeequan.jeepay.components.mq.vender.IMQMsgReceiver;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.jms.annotation.JmsListener;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* activeMQ 消息接收器:仅在vender=activeMQ时 && 项目实现IMQReceiver接口时 进行实例化
|
||||
* 业务: 支付订单补单(一般用于没有回调的接口,比如微信的条码支付)
|
||||
*
|
||||
* @author terrfly
|
||||
* @date 2021/7/22 17:06
|
||||
*/
|
||||
@Component
|
||||
@ConditionalOnProperty(name = MQVenderCS.YML_VENDER_KEY, havingValue = MQVenderCS.ACTIVE_MQ)
|
||||
@ConditionalOnBean(PayOrderReissueMQ.IMQReceiver.class)
|
||||
public class PayOrderReissueActiveMQReceiver implements IMQMsgReceiver {
|
||||
|
||||
@Autowired
|
||||
private PayOrderReissueMQ.IMQReceiver mqReceiver;
|
||||
|
||||
/** 接收 【 queue 】 类型的消息 **/
|
||||
@Override
|
||||
@Async(MqThreadExecutor.EXECUTOR_PAY_ORDER_REISSUE)
|
||||
@JmsListener(destination = PayOrderReissueMQ.MQ_NAME)
|
||||
public void receiveMsg(String msg){
|
||||
mqReceiver.receive(PayOrderReissueMQ.parse(msg));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.jeequan.jeepay.components.mq.vender.activemq.receive;
|
||||
|
||||
import com.jeequan.jeepay.components.mq.constant.MQVenderCS;
|
||||
import com.jeequan.jeepay.components.mq.executor.MqThreadExecutor;
|
||||
import com.jeequan.jeepay.components.mq.model.PushPrinterMQ;
|
||||
import com.jeequan.jeepay.components.mq.vender.IMQMsgReceiver;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.jms.annotation.JmsListener;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* activeMQ消息接收器:仅在vender=activeMQ时 && 项目实现IMQReceiver接口时 进行实例化
|
||||
* 业务: 云打印推送
|
||||
*
|
||||
* @author terrfly
|
||||
* @date 2021/7/22 17:06
|
||||
*/
|
||||
@Component
|
||||
@ConditionalOnProperty(name = MQVenderCS.YML_VENDER_KEY, havingValue = MQVenderCS.ACTIVE_MQ)
|
||||
@ConditionalOnBean(PushPrinterMQ.IMQReceiver.class)
|
||||
public class PushPrinterActiveMQReceiver implements IMQMsgReceiver {
|
||||
|
||||
@Autowired
|
||||
private PushPrinterMQ.IMQReceiver mqReceiver;
|
||||
|
||||
/** 接收 【 queue 】 类型的消息 **/
|
||||
@Override
|
||||
@Async(MqThreadExecutor.EXECUTOR_PUSH_PRINTER)
|
||||
@JmsListener(destination = PushPrinterMQ.MQ_NAME)
|
||||
public void receiveMsg(String msg){
|
||||
mqReceiver.receive(PushPrinterMQ.parse(msg));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.jeequan.jeepay.components.mq.vender.activemq.receive;
|
||||
|
||||
import com.jeequan.jeepay.components.mq.constant.MQVenderCS;
|
||||
import com.jeequan.jeepay.components.mq.executor.MqThreadExecutor;
|
||||
import com.jeequan.jeepay.components.mq.model.PushSpeakerMQ;
|
||||
import com.jeequan.jeepay.components.mq.vender.IMQMsgReceiver;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.jms.annotation.JmsListener;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* activeMQ消息接收器:仅在vender=activeMQ时 && 项目实现IMQReceiver接口时 进行实例化
|
||||
* 业务: 云喇叭推送
|
||||
*
|
||||
* @author terrfly
|
||||
* @date 2021/7/22 17:06
|
||||
*/
|
||||
@Component
|
||||
@ConditionalOnProperty(name = MQVenderCS.YML_VENDER_KEY, havingValue = MQVenderCS.ACTIVE_MQ)
|
||||
@ConditionalOnBean(PushSpeakerMQ.IMQReceiver.class)
|
||||
public class PushSpeakerActiveMQReceiver implements IMQMsgReceiver {
|
||||
|
||||
@Autowired
|
||||
private PushSpeakerMQ.IMQReceiver mqReceiver;
|
||||
|
||||
/** 接收 【 queue 】 类型的消息 **/
|
||||
@Override
|
||||
@Async(MqThreadExecutor.EXECUTOR_PUSH_SPEAKER)
|
||||
@JmsListener(destination = PushSpeakerMQ.MQ_NAME)
|
||||
public void receiveMsg(String msg){
|
||||
mqReceiver.receive(PushSpeakerMQ.parse(msg));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.jeequan.jeepay.components.mq.vender.activemq.receive;
|
||||
|
||||
import com.jeequan.jeepay.components.mq.constant.MQVenderCS;
|
||||
import com.jeequan.jeepay.components.mq.executor.MqThreadExecutor;
|
||||
import com.jeequan.jeepay.components.mq.model.PushWxMpMsgMQ;
|
||||
import com.jeequan.jeepay.components.mq.vender.IMQMsgReceiver;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.jms.annotation.JmsListener;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* activeMQ消息接收器:仅在vender=activeMQ时 && 项目实现IMQReceiver接口时 进行实例化
|
||||
* 业务: 微信公众号通知
|
||||
*
|
||||
* @author terrfly
|
||||
* @date 2021/7/22 17:06
|
||||
*/
|
||||
@Component
|
||||
@ConditionalOnProperty(name = MQVenderCS.YML_VENDER_KEY, havingValue = MQVenderCS.ACTIVE_MQ)
|
||||
@ConditionalOnBean(PushWxMpMsgMQ.IMQReceiver.class)
|
||||
public class PushWxMpMsgActiveMQReceiver implements IMQMsgReceiver {
|
||||
|
||||
@Autowired
|
||||
private PushWxMpMsgMQ.IMQReceiver mqReceiver;
|
||||
|
||||
/** 接收 【 queue 】 类型的消息 **/
|
||||
@Override
|
||||
@Async(MqThreadExecutor.EXECUTOR_PUSH_MP_MSG)
|
||||
@JmsListener(destination = PushWxMpMsgMQ.MQ_NAME)
|
||||
public void receiveMsg(String msg){
|
||||
mqReceiver.receive(PushWxMpMsgMQ.parse(msg));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
package com.jeequan.jeepay.components.mq.vender.activemq.receive;
|
||||
|
||||
import com.jeequan.jeepay.components.mq.constant.MQVenderCS;
|
||||
import com.jeequan.jeepay.components.mq.model.ResetAppConfigMQ;
|
||||
import com.jeequan.jeepay.components.mq.vender.IMQMsgReceiver;
|
||||
import com.jeequan.jeepay.components.mq.vender.activemq.ActiveMQConfig;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.jms.annotation.JmsListener;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* activeMQ消息接收器:仅在vender=activeMQ时 && 项目实现IMQReceiver接口时 进行实例化
|
||||
* 业务: 更新系统配置参数
|
||||
*
|
||||
* @author terrfly
|
||||
* @date 2021/7/22 17:06
|
||||
*/
|
||||
@Component
|
||||
@ConditionalOnProperty(name = MQVenderCS.YML_VENDER_KEY, havingValue = MQVenderCS.ACTIVE_MQ)
|
||||
@ConditionalOnBean(ResetAppConfigMQ.IMQReceiver.class)
|
||||
public class ResetAppConfigActiveMQReceiver implements IMQMsgReceiver {
|
||||
|
||||
@Autowired
|
||||
private ResetAppConfigMQ.IMQReceiver mqReceiver;
|
||||
|
||||
/** 接收 【 MQSendTypeEnum.BROADCAST 】 广播类型的消息 **/
|
||||
@Override
|
||||
@JmsListener(destination = ResetAppConfigMQ.MQ_NAME, containerFactory = ActiveMQConfig.TOPIC_LISTENER_CONTAINER)
|
||||
public void receiveMsg(String msg){
|
||||
mqReceiver.receive(ResetAppConfigMQ.parse(msg));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.jeequan.jeepay.components.mq.vender.activemq.receive;
|
||||
|
||||
import com.jeequan.jeepay.components.mq.constant.MQVenderCS;
|
||||
import com.jeequan.jeepay.components.mq.model.ResetIsvMchAppInfoConfigMQ;
|
||||
import com.jeequan.jeepay.components.mq.vender.IMQMsgReceiver;
|
||||
import com.jeequan.jeepay.components.mq.vender.activemq.ActiveMQConfig;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.jms.annotation.JmsListener;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* activeMQ消息接收器:仅在vender=activeMQ时 && 项目实现IMQReceiver接口时 进行实例化
|
||||
* 业务: 更新服务商/商户/商户应用配置信息;
|
||||
*
|
||||
* @author terrfly
|
||||
* @date 2021/7/22 17:06
|
||||
*/
|
||||
@Component
|
||||
@ConditionalOnProperty(name = MQVenderCS.YML_VENDER_KEY, havingValue = MQVenderCS.ACTIVE_MQ)
|
||||
@ConditionalOnBean(ResetIsvMchAppInfoConfigMQ.IMQReceiver.class)
|
||||
public class ResetIsvMchAppInfoActiveMQReceiver implements IMQMsgReceiver {
|
||||
|
||||
@Autowired
|
||||
private ResetIsvMchAppInfoConfigMQ.IMQReceiver mqReceiver;
|
||||
|
||||
/**
|
||||
* 接收 【 MQSendTypeEnum.BROADCAST 】 广播类型的消息
|
||||
**/
|
||||
@Override
|
||||
@JmsListener(destination = ResetIsvMchAppInfoConfigMQ.MQ_NAME, containerFactory = ActiveMQConfig.TOPIC_LISTENER_CONTAINER)
|
||||
public void receiveMsg(String msg) {
|
||||
mqReceiver.receive(ResetIsvMchAppInfoConfigMQ.parse(msg));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.jeequan.jeepay.components.mq.vender.activemq.receive;
|
||||
|
||||
import com.jeequan.jeepay.components.mq.constant.MQVenderCS;
|
||||
import com.jeequan.jeepay.components.mq.executor.MqThreadExecutor;
|
||||
import com.jeequan.jeepay.components.mq.model.ZftSettOrderMQ;
|
||||
import com.jeequan.jeepay.components.mq.vender.IMQMsgReceiver;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.jms.annotation.JmsListener;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* activeMQ 消息接收器:仅在vender=activeMQ时 && 项目实现IMQReceiver接口时 进行实例化
|
||||
* 业务: 直付通订单结算通知
|
||||
*
|
||||
* @author xiaoyu
|
||||
* @date 2021/7/22 17:06
|
||||
*/
|
||||
@Component
|
||||
@ConditionalOnProperty(name = MQVenderCS.YML_VENDER_KEY, havingValue = MQVenderCS.ACTIVE_MQ)
|
||||
@ConditionalOnBean(ZftSettOrderMQ.IMQReceiver.class)
|
||||
public class ZftSettOrderActiveMQReceiver implements IMQMsgReceiver {
|
||||
|
||||
@Autowired
|
||||
private ZftSettOrderMQ.IMQReceiver mqReceiver;
|
||||
|
||||
/** 接收 【 queue 】 类型的消息 **/
|
||||
@Override
|
||||
@Async(MqThreadExecutor.EXECUTOR_ZFT_SETT_ORDER)
|
||||
@JmsListener(destination = ZftSettOrderMQ.MQ_NAME)
|
||||
public void receiveMsg(String msg){
|
||||
mqReceiver.receive(ZftSettOrderMQ.parse(msg));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
package com.jeequan.jeepay.components.mq.vender.aliyunrocketmq;
|
||||
|
||||
import com.aliyun.openservices.ons.api.Action;
|
||||
import com.aliyun.openservices.ons.api.Consumer;
|
||||
import com.jeequan.jeepay.components.mq.constant.MQSendTypeEnum;
|
||||
import com.jeequan.jeepay.components.mq.vender.IMQMsgReceiver;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
@Slf4j
|
||||
public abstract class AbstractAliYunRocketMQReceiver implements IMQMsgReceiver, InitializingBean {
|
||||
|
||||
@Autowired
|
||||
private AliYunRocketMQFactory aliYunRocketMQFactory;
|
||||
|
||||
/**
|
||||
* 获取topic名称
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public abstract String getMQName();
|
||||
|
||||
/**
|
||||
* 获取业务名称
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public abstract String getConsumerName();
|
||||
|
||||
/**
|
||||
* 发送类型
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public MQSendTypeEnum getMQType() {
|
||||
// QUEUE - 点对点 (只有1个消费者可消费。 ActiveMQ的queue模式 )
|
||||
return MQSendTypeEnum.QUEUE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
|
||||
Consumer aliyunConsumer = getMQType().equals(MQSendTypeEnum.BROADCAST) ?
|
||||
aliYunRocketMQFactory.getAliyunRocketMQClientBroadcastConsumer() : aliYunRocketMQFactory.getAliyunRocketMQConsumer();
|
||||
|
||||
aliyunConsumer.subscribe(this.getMQName(), AliYunRocketMQFactory.DEFAULT_TAG, (message, context) -> {
|
||||
try {
|
||||
receiveMsg(new String(message.getBody()));
|
||||
log.debug("【{}】MQ消息消费成功topic:{}, messageId:{}", getConsumerName(), message.getTopic(), message.getMsgID());
|
||||
return Action.CommitMessage;
|
||||
} catch (Exception e) {
|
||||
log.error("【{}】MQ消息消费失败topic:{}, messageId:{}", getConsumerName(), message.getTopic(), message.getMsgID(), e);
|
||||
}
|
||||
return Action.ReconsumeLater;
|
||||
});
|
||||
aliyunConsumer.start();
|
||||
log.info("初始化[{}]消费者topic: {},tag: {}成功", getConsumerName(), this.getMQName(), AliYunRocketMQFactory.DEFAULT_TAG);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,107 @@
|
||||
package com.jeequan.jeepay.components.mq.vender.aliyunrocketmq;
|
||||
|
||||
import com.aliyun.openservices.ons.api.*;
|
||||
import com.jeequan.jeepay.components.mq.constant.MQVenderCS;
|
||||
import com.jeequan.jeepay.core.interfaces.ICodeSysTypeManager;
|
||||
import lombok.Data;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
@Service
|
||||
@ConditionalOnProperty(name = MQVenderCS.YML_VENDER_KEY, havingValue = MQVenderCS.ALIYUN_ROCKET_MQ)
|
||||
@Data
|
||||
public class AliYunRocketMQFactory implements InitializingBean {
|
||||
|
||||
public static final String DEFAULT_TAG = "Default";
|
||||
|
||||
@Autowired private ICodeSysTypeManager codeSysTypeManager;
|
||||
|
||||
//消费者, 每个机器创建一个消费者示例 ,可以通过 多个订阅函数(subscribe)来增加。
|
||||
private Consumer aliyunRocketMQConsumer;
|
||||
|
||||
//广播模式消费者
|
||||
private Consumer aliyunRocketMQClientBroadcastConsumer;
|
||||
|
||||
|
||||
@Value("${aliyun-rocketmq.namesrvAddr}")
|
||||
public String namesrvAddr;
|
||||
@Value("${aliyun-rocketmq.accessKey}")
|
||||
private String accessKey;
|
||||
@Value("${aliyun-rocketmq.secretKey}")
|
||||
private String secretKey;
|
||||
@Value("${aliyun-rocketmq.groupIdPrefix}")
|
||||
private String groupIdPrefix;
|
||||
|
||||
@Bean(name = "producerClient")
|
||||
public Producer producerClient() {
|
||||
Properties properties = new Properties();
|
||||
properties.put(PropertyKeyConst.GROUP_ID, genGroupId(false)); // 生产者的groupID 意义不大。
|
||||
properties.put(PropertyKeyConst.AccessKey, accessKey);
|
||||
properties.put(PropertyKeyConst.SecretKey, secretKey);
|
||||
// 判断是否为空(生产环境走k8s集群环境变量自动注入,不获取本地配置文件的值)
|
||||
if (StringUtils.isNotEmpty(namesrvAddr)) {
|
||||
properties.put(PropertyKeyConst.NAMESRV_ADDR, namesrvAddr);
|
||||
}
|
||||
return ONSFactory.createProducer(properties);
|
||||
}
|
||||
|
||||
private Consumer genAliyunRocketMQConsumer(boolean isBROADCASTING) {
|
||||
Properties properties = new Properties();
|
||||
properties.put(PropertyKeyConst.GROUP_ID, genGroupId(isBROADCASTING));
|
||||
properties.put(PropertyKeyConst.AccessKey, accessKey);
|
||||
properties.put(PropertyKeyConst.SecretKey, secretKey);
|
||||
|
||||
// 广播订阅方式设置
|
||||
if(isBROADCASTING){
|
||||
properties.put(PropertyKeyConst.MessageModel, PropertyValueConst.BROADCASTING);
|
||||
}
|
||||
|
||||
// 判断是否为空(生产环境走k8s集群环境变量自动注入,不获取本地配置文件的值)
|
||||
if (StringUtils.isNotEmpty(namesrvAddr)) {
|
||||
properties.put(PropertyKeyConst.NAMESRV_ADDR, namesrvAddr);
|
||||
}
|
||||
|
||||
return ONSFactory.createConsumer(properties);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* 阿里云ROCKETMQ, 在 消费者端的gid下的机器要求所有的监听topID是一样的, 如果不一样可能出现丢失消息的情况。
|
||||
* 消息模式也应该是一样的(文档没有写,但是在 【消息队列 RocketMQ 版/实例列表/Group 管理/Group 详情】)
|
||||
* 可以清晰的看到 消费模式, 是放置在上面的, 也就是需要是一样的。 !
|
||||
*
|
||||
*
|
||||
* 【消息队列 RocketMQ 版/实例列表/Group 管理/Group 详情】 如果有异常, 这里可以清晰的看到。
|
||||
*
|
||||
* 阿里云文档 :https://help.aliyun.com/document_detail/43523.html?spm=5176.rocketmq.help.dexternal.4370176fcn7PRB
|
||||
*
|
||||
* GroupID命名规则: 前缀 + 系统名称 + 模式
|
||||
* 示例:
|
||||
* GID_JEEPAY_MANAGER_BROADCAST : 运营平台_广播分组
|
||||
* GID_JEEPAY_PAYMENT_QUEUE : 支付网关_队列分组
|
||||
* GID_JEEPAY_PAYMENT_BROADCAST : 支付网关_广播分组
|
||||
*
|
||||
*
|
||||
* **/
|
||||
private String genGroupId(boolean isBROADCASTING){
|
||||
return groupIdPrefix + codeSysTypeManager.getCodeSysName() + (isBROADCASTING ? "_BROADCAST" : "_QUEUE");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
|
||||
this.aliyunRocketMQConsumer = genAliyunRocketMQConsumer(false);
|
||||
|
||||
this.aliyunRocketMQClientBroadcastConsumer = genAliyunRocketMQConsumer(true);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
package com.jeequan.jeepay.components.mq.vender.aliyunrocketmq;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.aliyun.openservices.ons.api.Message;
|
||||
import com.aliyun.openservices.ons.api.Producer;
|
||||
import com.aliyun.openservices.ons.api.SendResult;
|
||||
import com.jeequan.jeepay.components.mq.constant.MQVenderCS;
|
||||
import com.jeequan.jeepay.components.mq.model.AbstractMQ;
|
||||
import com.jeequan.jeepay.components.mq.vender.IMQSender;
|
||||
import com.jeequan.jeepay.core.utils.DateKit;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* 阿里云rocketMQ 消息发送器的实现
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
@ConditionalOnProperty(name = MQVenderCS.YML_VENDER_KEY, havingValue = MQVenderCS.ALIYUN_ROCKET_MQ)
|
||||
public class AliYunRocketMQSender implements IMQSender {
|
||||
|
||||
/** 最大延迟24小时 */
|
||||
private static final int MAX_DELAY_TIME = 60 * 60 * 24;
|
||||
/** 最小延迟1秒 */
|
||||
private static final int MIN_DELAY_TIME = 1;
|
||||
|
||||
@Autowired
|
||||
private AliYunRocketMQFactory aliYunRocketMQFactory;
|
||||
private Producer producerClient;
|
||||
|
||||
@Override
|
||||
public void send(AbstractMQ mqModel) {
|
||||
Message message = new Message(mqModel.getMQName(), AliYunRocketMQFactory.DEFAULT_TAG, mqModel.toMessage().getBytes());
|
||||
sendMessage(message);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void send(AbstractMQ mqModel, int delaySeconds) {
|
||||
Message message = new Message(mqModel.getMQName(), AliYunRocketMQFactory.DEFAULT_TAG, mqModel.toMessage().getBytes());
|
||||
if (delaySeconds > 0) {
|
||||
long delayTime = DateKit.currentTimeMillis() + delayTimeCorrector(delaySeconds) * 1000;
|
||||
// 设置消息需要被投递的时间。
|
||||
message.setStartDeliverTime(delayTime);
|
||||
}
|
||||
sendMessage(message);
|
||||
}
|
||||
|
||||
private void sendMessage(Message message) {
|
||||
if (producerClient == null) {
|
||||
producerClient = aliYunRocketMQFactory.producerClient();
|
||||
}
|
||||
producerClient.start();
|
||||
SendResult sendResult = producerClient.send(message);
|
||||
log.info("消息队列推送返回结果:{}", JSON.toJSONString(sendResult));
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查延迟时间的有效性并返回校正后的延迟时间
|
||||
**/
|
||||
private int delayTimeCorrector(int delay) {
|
||||
if (delay < MIN_DELAY_TIME) {
|
||||
return MIN_DELAY_TIME;
|
||||
} else if (delay > MAX_DELAY_TIME) {
|
||||
return MAX_DELAY_TIME;
|
||||
} else {
|
||||
return delay;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
/*
|
||||
* Copyright (c) 2021-2031, 河北计全科技有限公司 (https://www.jeequan.com & jeequan@126.com).
|
||||
* <p>
|
||||
* Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0;
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* <p>
|
||||
* http://www.gnu.org/licenses/lgpl.html
|
||||
* <p>
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.jeequan.jeepay.components.mq.vender.aliyunrocketmq.receive;
|
||||
|
||||
import com.jeequan.jeepay.components.mq.constant.MQVenderCS;
|
||||
import com.jeequan.jeepay.components.mq.executor.MqThreadExecutor;
|
||||
import com.jeequan.jeepay.components.mq.model.AccountBalanceMQ;
|
||||
import com.jeequan.jeepay.components.mq.vender.aliyunrocketmq.AbstractAliYunRocketMQReceiver;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* AliYunRocketMQ消息接收器:仅在vender=AliYunRocketMQ时 && 项目实现IMQReceiver接口时 进行实例化
|
||||
* 业务: 订单支付成功 app推送
|
||||
*
|
||||
* @author terrfly
|
||||
*
|
||||
* @date 2021/7/22 17:06
|
||||
*/
|
||||
@Component
|
||||
@ConditionalOnProperty(name = MQVenderCS.YML_VENDER_KEY, havingValue = MQVenderCS.ALIYUN_ROCKET_MQ)
|
||||
@ConditionalOnBean(AccountBalanceMQ.IMQReceiver.class)
|
||||
public class AccountBalanceAliYunRocketMQReceiver extends AbstractAliYunRocketMQReceiver {
|
||||
|
||||
private static final String CONSUMER_NAME = "账户余额变动";
|
||||
|
||||
@Autowired
|
||||
private AccountBalanceMQ.IMQReceiver mqReceiver;
|
||||
|
||||
/**
|
||||
* 接收 【 queue 】 类型的消息
|
||||
**/
|
||||
@Override
|
||||
@Async(MqThreadExecutor.EXECUTOR_ACCOUNT_BALANCE)
|
||||
public void receiveMsg(String msg){
|
||||
mqReceiver.receive(AccountBalanceMQ.parse(msg));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取topic名称
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public String getMQName() {
|
||||
return AccountBalanceMQ.MQ_NAME;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取业务名称
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public String getConsumerName() {
|
||||
return CONSUMER_NAME;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
package com.jeequan.jeepay.components.mq.vender.aliyunrocketmq.receive;
|
||||
|
||||
import com.jeequan.jeepay.components.mq.constant.MQVenderCS;
|
||||
import com.jeequan.jeepay.components.mq.executor.MqThreadExecutor;
|
||||
import com.jeequan.jeepay.components.mq.model.AppPushMQ;
|
||||
import com.jeequan.jeepay.components.mq.vender.aliyunrocketmq.AbstractAliYunRocketMQReceiver;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* AliYunRocketMQ消息接收器:仅在vender=AliYunRocketMQ时 && 项目实现IMQReceiver接口时 进行实例化
|
||||
* 业务: 订单支付成功 app推送
|
||||
*
|
||||
* @author terrfly
|
||||
*
|
||||
* @date 2021/7/22 17:06
|
||||
*/
|
||||
@Component
|
||||
@ConditionalOnProperty(name = MQVenderCS.YML_VENDER_KEY, havingValue = MQVenderCS.ALIYUN_ROCKET_MQ)
|
||||
@ConditionalOnBean(AppPushMQ.IMQReceiver.class)
|
||||
public class AppPushAliYunRocketMQReceiver extends AbstractAliYunRocketMQReceiver {
|
||||
|
||||
private static final String CONSUMER_NAME = "订单支付成功app推送";
|
||||
|
||||
@Autowired
|
||||
private AppPushMQ.IMQReceiver mqReceiver;
|
||||
|
||||
/**
|
||||
* 接收 【 queue 】 类型的消息
|
||||
**/
|
||||
@Override
|
||||
@Async(MqThreadExecutor.EXECUTOR_APP_PUSH)
|
||||
public void receiveMsg(String msg){
|
||||
mqReceiver.receive(AppPushMQ.parse(msg));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取topic名称
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public String getMQName() {
|
||||
return AppPushMQ.MQ_NAME;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取业务名称
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public String getConsumerName() {
|
||||
return CONSUMER_NAME;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
package com.jeequan.jeepay.components.mq.vender.aliyunrocketmq.receive;
|
||||
|
||||
import com.jeequan.jeepay.components.mq.constant.MQVenderCS;
|
||||
import com.jeequan.jeepay.components.mq.executor.MqThreadExecutor;
|
||||
import com.jeequan.jeepay.components.mq.model.CleanAgentLoginAuthCacheMQ;
|
||||
import com.jeequan.jeepay.components.mq.vender.aliyunrocketmq.AbstractAliYunRocketMQReceiver;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* AliYunRocketMQ消息接收器:仅在vender=AliYunRocketMQ时 && 项目实现IMQReceiver接口时 进行实例化
|
||||
* 业务: 清除服务商登录信息
|
||||
*/
|
||||
@Component
|
||||
@ConditionalOnProperty(name = MQVenderCS.YML_VENDER_KEY, havingValue = MQVenderCS.ALIYUN_ROCKET_MQ)
|
||||
@ConditionalOnBean(CleanAgentLoginAuthCacheMQ.IMQReceiver.class)
|
||||
@Slf4j
|
||||
public class CleanAgentLoginAuthCacheAliYunRocketMQReceiver extends AbstractAliYunRocketMQReceiver {
|
||||
|
||||
private static final String CONSUMER_NAME = "清除服务商登录消息";
|
||||
|
||||
@Autowired
|
||||
private CleanAgentLoginAuthCacheMQ.IMQReceiver mqReceiver;
|
||||
|
||||
/**
|
||||
* 接收 【 queue 】 类型的消息
|
||||
**/
|
||||
@Override
|
||||
@Async(MqThreadExecutor.EXECUTOR_COMMON)
|
||||
public void receiveMsg(String msg) {
|
||||
mqReceiver.receive(CleanAgentLoginAuthCacheMQ.parse(msg));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取topic名称
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public String getMQName() {
|
||||
return CleanAgentLoginAuthCacheMQ.MQ_NAME;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取业务名称
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public String getConsumerName() {
|
||||
return CONSUMER_NAME;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
package com.jeequan.jeepay.components.mq.vender.aliyunrocketmq.receive;
|
||||
|
||||
import com.jeequan.jeepay.components.mq.constant.MQVenderCS;
|
||||
import com.jeequan.jeepay.components.mq.executor.MqThreadExecutor;
|
||||
import com.jeequan.jeepay.components.mq.model.CleanMchLoginAuthCacheMQ;
|
||||
import com.jeequan.jeepay.components.mq.vender.aliyunrocketmq.AbstractAliYunRocketMQReceiver;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* AliYunRocketMQ消息接收器:仅在vender=AliYunRocketMQ时 && 项目实现IMQReceiver接口时 进行实例化
|
||||
* 业务: 清除商户登录信息
|
||||
*/
|
||||
@Component
|
||||
@ConditionalOnProperty(name = MQVenderCS.YML_VENDER_KEY, havingValue = MQVenderCS.ALIYUN_ROCKET_MQ)
|
||||
@ConditionalOnBean(CleanMchLoginAuthCacheMQ.IMQReceiver.class)
|
||||
@Slf4j
|
||||
public class CleanMchLoginAuthCacheAliYunRocketMQReceiver extends AbstractAliYunRocketMQReceiver {
|
||||
|
||||
private static final String CONSUMER_NAME = "清除商户登录消息";
|
||||
|
||||
@Autowired
|
||||
private CleanMchLoginAuthCacheMQ.IMQReceiver mqReceiver;
|
||||
|
||||
/**
|
||||
* 接收 【 queue 】 类型的消息
|
||||
**/
|
||||
@Override
|
||||
@Async(MqThreadExecutor.EXECUTOR_COMMON)
|
||||
public void receiveMsg(String msg) {
|
||||
mqReceiver.receive(CleanMchLoginAuthCacheMQ.parse(msg));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取topic名称
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public String getMQName() {
|
||||
return CleanMchLoginAuthCacheMQ.MQ_NAME;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取业务名称
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public String getConsumerName() {
|
||||
return CONSUMER_NAME;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package com.jeequan.jeepay.components.mq.vender.aliyunrocketmq.receive;
|
||||
|
||||
import com.jeequan.jeepay.components.mq.constant.MQVenderCS;
|
||||
import com.jeequan.jeepay.components.mq.executor.MqThreadExecutor;
|
||||
import com.jeequan.jeepay.components.mq.model.MchAuditMQ;
|
||||
import com.jeequan.jeepay.components.mq.vender.aliyunrocketmq.AbstractAliYunRocketMQReceiver;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.jms.annotation.JmsListener;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
@ConditionalOnProperty(name = MQVenderCS.YML_VENDER_KEY, havingValue = MQVenderCS.ROCKET_MQ)
|
||||
@ConditionalOnBean(MchAuditMQ.IMQReceiver.class)
|
||||
public class MchAuditAliYunRocketMQReceiver extends AbstractAliYunRocketMQReceiver {
|
||||
|
||||
private static final String CONSUMER_NAME = "进件后续步骤";
|
||||
|
||||
@Autowired
|
||||
private MchAuditMQ.IMQReceiver mqReceiver;
|
||||
|
||||
/** 接收 【 queue 】 类型的消息 **/
|
||||
@Override
|
||||
@Async(MqThreadExecutor.EXECUTOR_APP_PUSH)
|
||||
@JmsListener(destination = MchAuditMQ.MQ_NAME)
|
||||
public void receiveMsg(String msg){
|
||||
mqReceiver.receive(MchAuditMQ.parse(msg));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMQName() {
|
||||
return MchAuditMQ.MQ_NAME;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getConsumerName() {
|
||||
return CONSUMER_NAME;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
package com.jeequan.jeepay.components.mq.vender.aliyunrocketmq.receive;
|
||||
|
||||
import com.jeequan.jeepay.components.mq.constant.MQVenderCS;
|
||||
import com.jeequan.jeepay.components.mq.executor.MqThreadExecutor;
|
||||
import com.jeequan.jeepay.components.mq.model.PayOrderCashoutMQ;
|
||||
import com.jeequan.jeepay.components.mq.vender.aliyunrocketmq.AbstractAliYunRocketMQReceiver;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* AliYunRocketMQ消息接收器:仅在vender=AliYunRocketMQ时 && 项目实现IMQReceiver接口时 进行实例化
|
||||
* 业务:订单支付成功自动提现
|
||||
*
|
||||
* @author terrfly
|
||||
*
|
||||
* @date 2021/7/22 17:06
|
||||
*/
|
||||
@Component
|
||||
@ConditionalOnProperty(name = MQVenderCS.YML_VENDER_KEY, havingValue = MQVenderCS.ALIYUN_ROCKET_MQ)
|
||||
@ConditionalOnBean(PayOrderCashoutMQ.IMQReceiver.class)
|
||||
public class PayOrderCashoutAliYunRocketMQReceiver extends AbstractAliYunRocketMQReceiver {
|
||||
|
||||
private static final String CONSUMER_NAME = "订单支付成功自动提现";
|
||||
|
||||
@Autowired
|
||||
private PayOrderCashoutMQ.IMQReceiver mqReceiver;
|
||||
|
||||
/**
|
||||
* 接收 【 queue 】 类型的消息
|
||||
**/
|
||||
@Override
|
||||
@Async(MqThreadExecutor.EXECUTOR_PAY_ORDER_CASHOUT)
|
||||
public void receiveMsg(String msg){
|
||||
mqReceiver.receive(PayOrderCashoutMQ.parse(msg));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取topic名称
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public String getMQName() {
|
||||
return PayOrderCashoutMQ.MQ_NAME;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取业务名称
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public String getConsumerName() {
|
||||
return CONSUMER_NAME;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
package com.jeequan.jeepay.components.mq.vender.aliyunrocketmq.receive;
|
||||
|
||||
import com.jeequan.jeepay.components.mq.constant.MQVenderCS;
|
||||
import com.jeequan.jeepay.components.mq.executor.MqThreadExecutor;
|
||||
import com.jeequan.jeepay.components.mq.model.PayOrderDivisionMQ;
|
||||
import com.jeequan.jeepay.components.mq.vender.aliyunrocketmq.AbstractAliYunRocketMQReceiver;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* AliYunRocketMQ消息接收器:仅在vender=AliYunRocketMQ时 && 项目实现IMQReceiver接口时 进行实例化
|
||||
* 业务: 支付订单分账通知
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
@ConditionalOnProperty(name = MQVenderCS.YML_VENDER_KEY, havingValue = MQVenderCS.ALIYUN_ROCKET_MQ)
|
||||
@ConditionalOnBean(PayOrderDivisionMQ.IMQReceiver.class)
|
||||
public class PayOrderDivisionAliYunRocketMQReceiver extends AbstractAliYunRocketMQReceiver {
|
||||
|
||||
private static final String CONSUMER_NAME = "支付订单分账消息";
|
||||
|
||||
@Autowired
|
||||
private PayOrderDivisionMQ.IMQReceiver mqReceiver;
|
||||
|
||||
/**
|
||||
* 接收 【 queue 】 类型的消息
|
||||
**/
|
||||
@Override
|
||||
@Async(MqThreadExecutor.EXECUTOR_PAY_ORDER_DIVISION)
|
||||
public void receiveMsg(String msg) {
|
||||
mqReceiver.receive(PayOrderDivisionMQ.parse(msg));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取topic名称
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public String getMQName() {
|
||||
return PayOrderDivisionMQ.MQ_NAME;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取业务名称
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public String getConsumerName() {
|
||||
return CONSUMER_NAME;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
package com.jeequan.jeepay.components.mq.vender.aliyunrocketmq.receive;
|
||||
|
||||
import com.jeequan.jeepay.components.mq.constant.MQVenderCS;
|
||||
import com.jeequan.jeepay.components.mq.executor.MqThreadExecutor;
|
||||
import com.jeequan.jeepay.components.mq.model.AccountBalanceMQ;
|
||||
import com.jeequan.jeepay.components.mq.model.PayOrderMarketMQ;
|
||||
import com.jeequan.jeepay.components.mq.vender.aliyunrocketmq.AbstractAliYunRocketMQReceiver;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* TODO
|
||||
*
|
||||
* @author crystal
|
||||
* @date 2024/1/29 16:33
|
||||
*/
|
||||
@Component
|
||||
@ConditionalOnProperty(name = MQVenderCS.YML_VENDER_KEY, havingValue = MQVenderCS.ALIYUN_ROCKET_MQ)
|
||||
@ConditionalOnBean(AccountBalanceMQ.IMQReceiver.class)
|
||||
public class PayOrderMarketAliYunRocketMQReceiver extends AbstractAliYunRocketMQReceiver {
|
||||
|
||||
private static final String CONSUMER_NAME = "营销转账";
|
||||
|
||||
@Autowired
|
||||
private AccountBalanceMQ.IMQReceiver mqReceiver;
|
||||
|
||||
/**
|
||||
* 接收 【 queue 】 类型的消息
|
||||
**/
|
||||
@Override
|
||||
@Async(MqThreadExecutor.EXECUTOR_PAY_ORDER_MARKET)
|
||||
public void receiveMsg(String msg){
|
||||
mqReceiver.receive(AccountBalanceMQ.parse(msg));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取topic名称
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public String getMQName() {
|
||||
return PayOrderMarketMQ.MQ_NAME;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取业务名称
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public String getConsumerName() {
|
||||
return CONSUMER_NAME;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
package com.jeequan.jeepay.components.mq.vender.aliyunrocketmq.receive;
|
||||
|
||||
import com.jeequan.jeepay.components.mq.constant.MQVenderCS;
|
||||
import com.jeequan.jeepay.components.mq.executor.MqThreadExecutor;
|
||||
import com.jeequan.jeepay.components.mq.model.PayOrderMchNotifyMQ;
|
||||
import com.jeequan.jeepay.components.mq.vender.aliyunrocketmq.AbstractAliYunRocketMQReceiver;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* AliYunRocketMQ消息接收器:仅在vender=AliYunRocketMQ时 && 项目实现IMQReceiver接口时 进行实例化
|
||||
* 业务: 支付订单商户通知
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
@ConditionalOnProperty(name = MQVenderCS.YML_VENDER_KEY, havingValue = MQVenderCS.ALIYUN_ROCKET_MQ)
|
||||
@ConditionalOnBean(PayOrderMchNotifyMQ.IMQReceiver.class)
|
||||
public class PayOrderMchNotifyAliYunRocketMQReceiver extends AbstractAliYunRocketMQReceiver {
|
||||
|
||||
private static final String CONSUMER_NAME = "支付订单商户消息";
|
||||
|
||||
@Autowired
|
||||
private PayOrderMchNotifyMQ.IMQReceiver mqReceiver;
|
||||
|
||||
/**
|
||||
* 接收 【 queue 】 类型的消息
|
||||
**/
|
||||
@Override
|
||||
@Async(MqThreadExecutor.EXECUTOR_PAY_ORDER_MCH_NOTIFY)
|
||||
public void receiveMsg(String msg) {
|
||||
mqReceiver.receive(PayOrderMchNotifyMQ.parse(msg));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取topic名称
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public String getMQName() {
|
||||
return PayOrderMchNotifyMQ.MQ_NAME;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取业务名称
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public String getConsumerName() {
|
||||
return CONSUMER_NAME;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
package com.jeequan.jeepay.components.mq.vender.aliyunrocketmq.receive;
|
||||
|
||||
import com.jeequan.jeepay.components.mq.constant.MQVenderCS;
|
||||
import com.jeequan.jeepay.components.mq.executor.MqThreadExecutor;
|
||||
import com.jeequan.jeepay.components.mq.model.PayOrderReissueMQ;
|
||||
import com.jeequan.jeepay.components.mq.vender.aliyunrocketmq.AbstractAliYunRocketMQReceiver;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* AliYunRocketMQ消息接收器:仅在vender=AliYunRocketMQ时 && 项目实现IMQReceiver接口时 进行实例化
|
||||
* 业务: 支付订单补单(一般用于没有回调的接口,比如微信的条码支付)
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
@ConditionalOnProperty(name = MQVenderCS.YML_VENDER_KEY, havingValue = MQVenderCS.ALIYUN_ROCKET_MQ)
|
||||
@ConditionalOnBean(PayOrderReissueMQ.IMQReceiver.class)
|
||||
public class PayOrderReissueAliYunRocketMQReceiver extends AbstractAliYunRocketMQReceiver {
|
||||
|
||||
private static final String CONSUMER_NAME = "支付订单补单消息";
|
||||
|
||||
@Autowired
|
||||
private PayOrderReissueMQ.IMQReceiver mqReceiver;
|
||||
|
||||
/**
|
||||
* 接收 【 queue 】 类型的消息
|
||||
**/
|
||||
@Override
|
||||
@Async(MqThreadExecutor.EXECUTOR_PAY_ORDER_REISSUE)
|
||||
public void receiveMsg(String msg) {
|
||||
mqReceiver.receive(PayOrderReissueMQ.parse(msg));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取topic名称
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public String getMQName() {
|
||||
return PayOrderReissueMQ.MQ_NAME;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取业务名称
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public String getConsumerName() {
|
||||
return CONSUMER_NAME;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
package com.jeequan.jeepay.components.mq.vender.aliyunrocketmq.receive;
|
||||
|
||||
import com.jeequan.jeepay.components.mq.constant.MQVenderCS;
|
||||
import com.jeequan.jeepay.components.mq.executor.MqThreadExecutor;
|
||||
import com.jeequan.jeepay.components.mq.model.PushPrinterMQ;
|
||||
import com.jeequan.jeepay.components.mq.vender.aliyunrocketmq.AbstractAliYunRocketMQReceiver;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* AliYunRocketMQ消息接收器:仅在vender=AliYunRocketMQ时 && 项目实现IMQReceiver接口时 进行实例化
|
||||
* 业务: 订单支付成功 云打印 通知消息
|
||||
*
|
||||
* @author terrfly
|
||||
*
|
||||
* @date 2021/7/22 17:06
|
||||
*/
|
||||
@Component
|
||||
@ConditionalOnProperty(name = MQVenderCS.YML_VENDER_KEY, havingValue = MQVenderCS.ALIYUN_ROCKET_MQ)
|
||||
@ConditionalOnBean(PushPrinterMQ.IMQReceiver.class)
|
||||
public class PushPrinterAliYunRocketMQReceiver extends AbstractAliYunRocketMQReceiver {
|
||||
|
||||
private static final String CONSUMER_NAME = "订单支付成功云打印通知消息";
|
||||
|
||||
@Autowired
|
||||
private PushPrinterMQ.IMQReceiver mqReceiver;
|
||||
|
||||
/**
|
||||
* 接收 【 queue 】 类型的消息
|
||||
**/
|
||||
@Override
|
||||
@Async(MqThreadExecutor.EXECUTOR_PUSH_PRINTER)
|
||||
public void receiveMsg(String msg){
|
||||
mqReceiver.receive(PushPrinterMQ.parse(msg));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取topic名称
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public String getMQName() {
|
||||
return PushPrinterMQ.MQ_NAME;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取业务名称
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public String getConsumerName() {
|
||||
return CONSUMER_NAME;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
package com.jeequan.jeepay.components.mq.vender.aliyunrocketmq.receive;
|
||||
|
||||
import com.jeequan.jeepay.components.mq.constant.MQVenderCS;
|
||||
import com.jeequan.jeepay.components.mq.executor.MqThreadExecutor;
|
||||
import com.jeequan.jeepay.components.mq.model.PushSpeakerMQ;
|
||||
import com.jeequan.jeepay.components.mq.vender.aliyunrocketmq.AbstractAliYunRocketMQReceiver;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* AliYunRocketMQ消息接收器:仅在vender=AliYunRocketMQ时 && 项目实现IMQReceiver接口时 进行实例化
|
||||
* 业务: 订单支付成功 云喇叭 通知消息
|
||||
*
|
||||
* @author terrfly
|
||||
* @date 2021/7/22 17:06
|
||||
*/
|
||||
@Component
|
||||
@ConditionalOnProperty(name = MQVenderCS.YML_VENDER_KEY, havingValue = MQVenderCS.ALIYUN_ROCKET_MQ)
|
||||
@ConditionalOnBean(PushSpeakerMQ.IMQReceiver.class)
|
||||
public class PushSpeakerAliYunRocketMQReceiver extends AbstractAliYunRocketMQReceiver {
|
||||
|
||||
private static final String CONSUMER_NAME = "订单支付成功云喇叭通知消息";
|
||||
|
||||
@Autowired
|
||||
private PushSpeakerMQ.IMQReceiver mqReceiver;
|
||||
|
||||
/**
|
||||
* 接收 【 queue 】 类型的消息
|
||||
**/
|
||||
@Override
|
||||
@Async(MqThreadExecutor.EXECUTOR_PUSH_SPEAKER)
|
||||
public void receiveMsg(String msg){
|
||||
mqReceiver.receive(PushSpeakerMQ.parse(msg));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取topic名称
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public String getMQName() {
|
||||
return PushSpeakerMQ.MQ_NAME;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取业务名称
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public String getConsumerName() {
|
||||
return CONSUMER_NAME;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
package com.jeequan.jeepay.components.mq.vender.aliyunrocketmq.receive;
|
||||
|
||||
import com.jeequan.jeepay.components.mq.constant.MQVenderCS;
|
||||
import com.jeequan.jeepay.components.mq.executor.MqThreadExecutor;
|
||||
import com.jeequan.jeepay.components.mq.model.PushWxMpMsgMQ;
|
||||
import com.jeequan.jeepay.components.mq.vender.aliyunrocketmq.AbstractAliYunRocketMQReceiver;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* AliYunRocketMQ消息接收器:仅在vender=AliYunRocketMQ时 && 项目实现IMQReceiver接口时 进行实例化
|
||||
* 业务: 订单支付成功 微信公众号 通知消息
|
||||
*
|
||||
* @author terrfly
|
||||
*
|
||||
* @date 2021/7/22 17:06
|
||||
*/
|
||||
@Component
|
||||
@ConditionalOnProperty(name = MQVenderCS.YML_VENDER_KEY, havingValue = MQVenderCS.ALIYUN_ROCKET_MQ)
|
||||
@ConditionalOnBean(PushWxMpMsgMQ.IMQReceiver.class)
|
||||
public class PushWxMpMsgAliYunRocketMQReceiver extends AbstractAliYunRocketMQReceiver {
|
||||
|
||||
private static final String CONSUMER_NAME = "订单支付成功消息通知";
|
||||
|
||||
@Autowired
|
||||
private PushWxMpMsgMQ.IMQReceiver mqReceiver;
|
||||
|
||||
/**
|
||||
* 接收 【 queue 】 类型的消息
|
||||
**/
|
||||
@Override
|
||||
@Async(MqThreadExecutor.EXECUTOR_PUSH_MP_MSG)
|
||||
public void receiveMsg(String msg){
|
||||
mqReceiver.receive(PushWxMpMsgMQ.parse(msg));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取topic名称
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public String getMQName() {
|
||||
return PushWxMpMsgMQ.MQ_NAME;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取业务名称
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public String getConsumerName() {
|
||||
return CONSUMER_NAME;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
package com.jeequan.jeepay.components.mq.vender.aliyunrocketmq.receive;
|
||||
|
||||
import com.jeequan.jeepay.components.mq.constant.MQSendTypeEnum;
|
||||
import com.jeequan.jeepay.components.mq.constant.MQVenderCS;
|
||||
import com.jeequan.jeepay.components.mq.model.ResetAppConfigMQ;
|
||||
import com.jeequan.jeepay.components.mq.vender.aliyunrocketmq.AbstractAliYunRocketMQReceiver;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* AliYunRocketMQ消息接收器:仅在vender=AliYunRocketMQ时 && 项目实现IMQReceiver接口时 进行实例化
|
||||
* 业务: 更新系统配置参数
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
@ConditionalOnProperty(name = MQVenderCS.YML_VENDER_KEY, havingValue = MQVenderCS.ALIYUN_ROCKET_MQ)
|
||||
@ConditionalOnBean(ResetAppConfigMQ.IMQReceiver.class)
|
||||
public class ResetAppConfigAliYunRocketMQReceiver extends AbstractAliYunRocketMQReceiver {
|
||||
|
||||
private static final String CONSUMER_NAME = "更新系统配置参数消息";
|
||||
|
||||
@Autowired
|
||||
private ResetAppConfigMQ.IMQReceiver mqReceiver;
|
||||
|
||||
/**
|
||||
* 接收 【 MQSendTypeEnum.BROADCAST 】 广播类型的消息
|
||||
* <p>
|
||||
* 注意:
|
||||
* AliYunRocketMQ的广播模式(fanout)交换机 --》全部的Queue
|
||||
* 如果queue包含多个消费者, 【例如,manager和payment的监听器是名称相同的queue下的消费者(Consumers) 】, 两个消费者是工作模式且存在竞争关系, 导致只能一个来消费。
|
||||
* 解决:
|
||||
* 每个topic的QUEUE都声明一个FANOUT交换机, 消费者声明一个系统产生的【随机队列】绑定到这个交换机上,然后往交换机发消息,只要绑定到这个交换机上都能收到消息。
|
||||
* 参考: https://bbs.csdn.net/topics/392509262?list=70088931
|
||||
**/
|
||||
@Override
|
||||
public void receiveMsg(String msg) {
|
||||
mqReceiver.receive(ResetAppConfigMQ.parse(msg));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取topic名称
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public String getMQName() {
|
||||
return ResetAppConfigMQ.MQ_NAME;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取业务名称
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public String getConsumerName() {
|
||||
return CONSUMER_NAME;
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送类型
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public MQSendTypeEnum getMQType() {
|
||||
// RocketMQ的广播模式
|
||||
return MQSendTypeEnum.BROADCAST;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
package com.jeequan.jeepay.components.mq.vender.aliyunrocketmq.receive;
|
||||
|
||||
import com.jeequan.jeepay.components.mq.constant.MQSendTypeEnum;
|
||||
import com.jeequan.jeepay.components.mq.constant.MQVenderCS;
|
||||
import com.jeequan.jeepay.components.mq.model.ResetIsvMchAppInfoConfigMQ;
|
||||
import com.jeequan.jeepay.components.mq.vender.aliyunrocketmq.AbstractAliYunRocketMQReceiver;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* AliYunRocketMQ消息接收器:仅在vender=AliYunRocketMQ时 && 项目实现IMQReceiver接口时 进行实例化
|
||||
* 业务: 更新服务商/商户/商户应用配置信息
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
@ConditionalOnProperty(name = MQVenderCS.YML_VENDER_KEY, havingValue = MQVenderCS.ALIYUN_ROCKET_MQ)
|
||||
@ConditionalOnBean(ResetIsvMchAppInfoConfigMQ.IMQReceiver.class)
|
||||
public class ResetIsvMchAppInfoAliYunRocketMQReceiver extends AbstractAliYunRocketMQReceiver {
|
||||
|
||||
private static final String CONSUMER_NAME = "更新服务商/商户/商户应用配置信息消息";
|
||||
|
||||
@Autowired
|
||||
private ResetIsvMchAppInfoConfigMQ.IMQReceiver mqReceiver;
|
||||
|
||||
/**
|
||||
* 接收 【 MQSendTypeEnum.BROADCAST 】 广播类型的消息
|
||||
* <p>
|
||||
* 注意:
|
||||
* AliYunRocketMQ的广播模式(fanout)交换机 --》全部的Queue
|
||||
* 如果queue包含多个消费者, 【例如,manager和payment的监听器是名称相同的queue下的消费者(Consumers) 】, 两个消费者是工作模式且存在竞争关系, 导致只能一个来消费。
|
||||
* 解决:
|
||||
* 每个topic的QUEUE都声明一个FANOUT交换机, 消费者声明一个系统产生的【随机队列】绑定到这个交换机上,然后往交换机发消息,只要绑定到这个交换机上都能收到消息。
|
||||
* 参考: https://bbs.csdn.net/topics/392509262?list=70088931
|
||||
**/
|
||||
@Override
|
||||
public void receiveMsg(String msg) {
|
||||
mqReceiver.receive(ResetIsvMchAppInfoConfigMQ.parse(msg));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取topic名称
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public String getMQName() {
|
||||
return ResetIsvMchAppInfoConfigMQ.MQ_NAME;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取业务名称
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public String getConsumerName() {
|
||||
return CONSUMER_NAME;
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送类型
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public MQSendTypeEnum getMQType() {
|
||||
// RocketMQ的广播模式
|
||||
return MQSendTypeEnum.BROADCAST;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
package com.jeequan.jeepay.components.mq.vender.aliyunrocketmq.receive;
|
||||
|
||||
import com.jeequan.jeepay.components.mq.constant.MQVenderCS;
|
||||
import com.jeequan.jeepay.components.mq.executor.MqThreadExecutor;
|
||||
import com.jeequan.jeepay.components.mq.model.ZftSettOrderMQ;
|
||||
import com.jeequan.jeepay.components.mq.vender.aliyunrocketmq.AbstractAliYunRocketMQReceiver;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* AliYunRocketMQ消息接收器:仅在vender=AliYunRocketMQ时 && 项目实现IMQReceiver接口时 进行实例化
|
||||
* 业务: 订单支付成功 app推送
|
||||
*
|
||||
* @author terrfly
|
||||
*
|
||||
* @date 2021/7/22 17:06
|
||||
*/
|
||||
@Component
|
||||
@ConditionalOnProperty(name = MQVenderCS.YML_VENDER_KEY, havingValue = MQVenderCS.ALIYUN_ROCKET_MQ)
|
||||
@ConditionalOnBean(ZftSettOrderMQ.IMQReceiver.class)
|
||||
public class ZftSettOrderAliYunRocketMQReceiver extends AbstractAliYunRocketMQReceiver {
|
||||
|
||||
private static final String CONSUMER_NAME = "订单结算(直付通)";
|
||||
|
||||
@Autowired
|
||||
private ZftSettOrderMQ.IMQReceiver mqReceiver;
|
||||
|
||||
/**
|
||||
* 接收 【 queue 】 类型的消息
|
||||
**/
|
||||
@Override
|
||||
@Async(MqThreadExecutor.EXECUTOR_ZFT_SETT_ORDER)
|
||||
public void receiveMsg(String msg){
|
||||
mqReceiver.receive(ZftSettOrderMQ.parse(msg));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取topic名称
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public String getMQName() {
|
||||
return ZftSettOrderMQ.MQ_NAME;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取业务名称
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public String getConsumerName() {
|
||||
return CONSUMER_NAME;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
package com.jeequan.jeepay.components.mq.vender.rabbitmq;
|
||||
|
||||
import com.jeequan.jeepay.components.mq.constant.MQVenderCS;
|
||||
import org.springframework.amqp.core.CustomExchange;
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
|
||||
import org.springframework.beans.factory.support.BeanDefinitionRegistry;
|
||||
import org.springframework.beans.factory.support.BeanDefinitionRegistryPostProcessor;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 将spring容器的 [bean注册器]放置到属性中,为 RabbitConfig提供访问。
|
||||
* 顺序:
|
||||
* 1. postProcessBeanDefinitionRegistry (存放注册器)
|
||||
* 2. postProcessBeanFactory (没有使用)
|
||||
* 3. 注册延迟消息交换机的bean: delayedExchange
|
||||
* 4. 动态配置RabbitMQ所需的bean。
|
||||
*
|
||||
* @author terrfly
|
||||
* @date 2021/7/23 16:27
|
||||
*/
|
||||
@Configuration
|
||||
@ConditionalOnProperty(name = MQVenderCS.YML_VENDER_KEY, havingValue = MQVenderCS.RABBIT_MQ)
|
||||
public class RabbitMQBeanProcessor implements BeanDefinitionRegistryPostProcessor {
|
||||
|
||||
/** bean注册器 **/
|
||||
protected BeanDefinitionRegistry beanDefinitionRegistry;
|
||||
|
||||
@Override
|
||||
public void postProcessBeanDefinitionRegistry(BeanDefinitionRegistry beanDefinitionRegistry) throws BeansException {
|
||||
this.beanDefinitionRegistry = beanDefinitionRegistry;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postProcessBeanFactory(ConfigurableListableBeanFactory configurableListableBeanFactory) throws BeansException {
|
||||
}
|
||||
|
||||
/** 自定义交换机: 用于延迟消息 **/
|
||||
@Bean(name = RabbitMQConfig.DELAYED_EXCHANGE_NAME)
|
||||
CustomExchange delayedExchange() {
|
||||
Map<String, Object> args = new HashMap<>();
|
||||
args.put("x-delayed-type", "direct");
|
||||
return new CustomExchange(RabbitMQConfig.DELAYED_EXCHANGE_NAME, "x-delayed-message", true, false, args);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,93 @@
|
||||
package com.jeequan.jeepay.components.mq.vender.rabbitmq;
|
||||
|
||||
import cn.hutool.core.util.ClassUtil;
|
||||
import cn.hutool.core.util.ReflectUtil;
|
||||
import com.jeequan.jeepay.components.mq.constant.MQSendTypeEnum;
|
||||
import com.jeequan.jeepay.components.mq.constant.MQVenderCS;
|
||||
import com.jeequan.jeepay.components.mq.model.AbstractMQ;
|
||||
import com.jeequan.jeepay.core.utils.SpringBeansUtil;
|
||||
import org.springframework.amqp.core.*;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.beans.factory.support.BeanDefinitionBuilder;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* RabbitMQ的配置项
|
||||
* 1. 注册全部定义好的Queue Bean
|
||||
* 2. 动态注册fanout交换机
|
||||
* 3. 将Queue模式绑定到延时消息的交换机
|
||||
*
|
||||
* @author terrfly
|
||||
* @date 2021/7/23 16:33
|
||||
*/
|
||||
@Component
|
||||
@ConditionalOnProperty(name = MQVenderCS.YML_VENDER_KEY, havingValue = MQVenderCS.RABBIT_MQ)
|
||||
public class RabbitMQConfig {
|
||||
|
||||
/** 全局定义延迟交换机名称 **/
|
||||
public static final String DELAYED_EXCHANGE_NAME = "delayedExchange";
|
||||
|
||||
/** 扇形交换机前缀(activeMQ中的topic模式), 需根据queue动态拼接 **/
|
||||
public static final String FANOUT_EXCHANGE_NAME_PREFIX = "fanout_exchange_";
|
||||
|
||||
/** 注入延迟交换机Bean **/
|
||||
@Autowired
|
||||
@Qualifier(DELAYED_EXCHANGE_NAME)
|
||||
private CustomExchange delayedExchange;
|
||||
|
||||
/** 注入rabbitMQBeanProcessor **/
|
||||
@Autowired
|
||||
private RabbitMQBeanProcessor rabbitMQBeanProcessor;
|
||||
|
||||
/** 在全部bean注册完成后再执行 **/
|
||||
@PostConstruct
|
||||
public void init(){
|
||||
|
||||
// 获取到所有的MQ定义
|
||||
Set<Class<?>> set = ClassUtil.scanPackageBySuper(ClassUtil.getPackage(AbstractMQ.class), AbstractMQ.class);
|
||||
|
||||
for (Class<?> aClass : set) {
|
||||
|
||||
// 实例化
|
||||
AbstractMQ amq = (AbstractMQ) ReflectUtil.newInstance(aClass);
|
||||
// 注册Queue === new Queue(name), queue名称/bean名称 = mqName
|
||||
rabbitMQBeanProcessor.beanDefinitionRegistry.registerBeanDefinition(amq.getMQName(),
|
||||
BeanDefinitionBuilder.rootBeanDefinition(Queue.class).addConstructorArgValue(amq.getMQName()).getBeanDefinition());
|
||||
|
||||
// 广播模式
|
||||
if(amq.getMQType() == MQSendTypeEnum.BROADCAST){
|
||||
|
||||
// 动态注册交换机, 交换机名称/bean名称 = FANOUT_EXCHANGE_NAME_PREFIX + amq.getMQName()
|
||||
rabbitMQBeanProcessor.beanDefinitionRegistry.registerBeanDefinition(FANOUT_EXCHANGE_NAME_PREFIX +amq.getMQName(),
|
||||
BeanDefinitionBuilder.genericBeanDefinition(FanoutExchange.class, () ->{
|
||||
|
||||
// 普通FanoutExchange 交换机
|
||||
return new FanoutExchange(FANOUT_EXCHANGE_NAME_PREFIX +amq.getMQName(),true,false);
|
||||
|
||||
// 支持 延迟的 FanoutExchange 交换机, 配置无效果。
|
||||
// Map<String, Object> args = new HashMap<>();
|
||||
// args.put("x-delayed-type", ExchangeTypes.FANOUT);
|
||||
// return new CustomExchange(RabbitMQConfig.DELAYED_EXCHANGE_NAME, "x-delayed-message", true, false, args);
|
||||
}
|
||||
|
||||
).getBeanDefinition()
|
||||
);
|
||||
|
||||
}else{
|
||||
|
||||
// 延迟交换机与Queue进行绑定, 绑定Bean名称 = mqName_DelayedBind
|
||||
rabbitMQBeanProcessor.beanDefinitionRegistry.registerBeanDefinition(amq.getMQName() + "_DelayedBind",
|
||||
BeanDefinitionBuilder.genericBeanDefinition(Binding.class, () ->
|
||||
BindingBuilder.bind(SpringBeansUtil.getBean(amq.getMQName(), Queue.class)).to(delayedExchange).with(amq.getMQName()).noargs()
|
||||
|
||||
).getBeanDefinition()
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
package com.jeequan.jeepay.components.mq.vender.rabbitmq;
|
||||
|
||||
import com.jeequan.jeepay.components.mq.constant.MQSendTypeEnum;
|
||||
import com.jeequan.jeepay.components.mq.constant.MQVenderCS;
|
||||
import com.jeequan.jeepay.components.mq.model.AbstractMQ;
|
||||
import com.jeequan.jeepay.components.mq.vender.IMQSender;
|
||||
import org.springframework.amqp.rabbit.core.RabbitTemplate;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* rabbitMQ 消息发送器的实现
|
||||
*
|
||||
* @author terrfly
|
||||
* @date 2021/7/23 16:52
|
||||
*/
|
||||
@Component
|
||||
@ConditionalOnProperty(name = MQVenderCS.YML_VENDER_KEY, havingValue = MQVenderCS.RABBIT_MQ)
|
||||
public class RabbitMQSender implements IMQSender {
|
||||
|
||||
@Autowired
|
||||
private RabbitTemplate rabbitTemplate;
|
||||
|
||||
@Override
|
||||
public void send(AbstractMQ mqModel) {
|
||||
|
||||
if(mqModel.getMQType() == MQSendTypeEnum.QUEUE){
|
||||
|
||||
rabbitTemplate.convertAndSend(mqModel.getMQName(), mqModel.toMessage());
|
||||
}else{
|
||||
|
||||
// fanout模式 的 routeKEY 没意义。
|
||||
this.rabbitTemplate.convertAndSend(RabbitMQConfig.FANOUT_EXCHANGE_NAME_PREFIX + mqModel.getMQName(), null, mqModel.toMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void send(AbstractMQ mqModel, int delay) {
|
||||
|
||||
|
||||
if(mqModel.getMQType() == MQSendTypeEnum.QUEUE){
|
||||
|
||||
rabbitTemplate.convertAndSend(RabbitMQConfig.DELAYED_EXCHANGE_NAME, mqModel.getMQName(), mqModel.toMessage(), messagePostProcessor ->{
|
||||
messagePostProcessor.getMessageProperties().setDelay(Math.toIntExact(delay * 1000));
|
||||
return messagePostProcessor;
|
||||
});
|
||||
}else{
|
||||
|
||||
// fanout模式 的 routeKEY 没意义。 没有延迟属性
|
||||
this.rabbitTemplate.convertAndSend(RabbitMQConfig.FANOUT_EXCHANGE_NAME_PREFIX + mqModel.getMQName(), null, mqModel.toMessage());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.jeequan.jeepay.components.mq.vender.rabbitmq.receive;
|
||||
|
||||
import com.jeequan.jeepay.components.mq.constant.MQVenderCS;
|
||||
import com.jeequan.jeepay.components.mq.executor.MqThreadExecutor;
|
||||
import com.jeequan.jeepay.components.mq.model.AccountBalanceMQ;
|
||||
import com.jeequan.jeepay.components.mq.vender.IMQMsgReceiver;
|
||||
import org.springframework.amqp.rabbit.annotation.RabbitListener;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* abbitMQ消息接收器:仅在vender=rabbitMQ时 && 项目实现IMQReceiver接口时 进行实例化
|
||||
* 业务: app推送
|
||||
*
|
||||
* @author terrfly
|
||||
* @date 2021/7/22 17:06
|
||||
*/
|
||||
@Component
|
||||
@ConditionalOnProperty(name = MQVenderCS.YML_VENDER_KEY, havingValue = MQVenderCS.RABBIT_MQ)
|
||||
@ConditionalOnBean(AccountBalanceMQ.IMQReceiver.class)
|
||||
public class AccountBalanceRabbitMQReceiver implements IMQMsgReceiver {
|
||||
|
||||
@Autowired
|
||||
private AccountBalanceMQ.IMQReceiver mqReceiver;
|
||||
|
||||
/** 接收 【 MQSendTypeEnum.QUEUE 】 类型的消息 **/
|
||||
@Override
|
||||
@Async(MqThreadExecutor.EXECUTOR_ACCOUNT_BALANCE)
|
||||
@RabbitListener(queues = AccountBalanceMQ.MQ_NAME)
|
||||
public void receiveMsg(String msg){
|
||||
mqReceiver.receive(AccountBalanceMQ.parse(msg));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.jeequan.jeepay.components.mq.vender.rabbitmq.receive;
|
||||
|
||||
import com.jeequan.jeepay.components.mq.constant.MQVenderCS;
|
||||
import com.jeequan.jeepay.components.mq.executor.MqThreadExecutor;
|
||||
import com.jeequan.jeepay.components.mq.model.AppPushMQ;
|
||||
import com.jeequan.jeepay.components.mq.vender.IMQMsgReceiver;
|
||||
import org.springframework.amqp.rabbit.annotation.RabbitListener;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* abbitMQ消息接收器:仅在vender=rabbitMQ时 && 项目实现IMQReceiver接口时 进行实例化
|
||||
* 业务: app推送
|
||||
*
|
||||
* @author terrfly
|
||||
* @date 2021/7/22 17:06
|
||||
*/
|
||||
@Component
|
||||
@ConditionalOnProperty(name = MQVenderCS.YML_VENDER_KEY, havingValue = MQVenderCS.RABBIT_MQ)
|
||||
@ConditionalOnBean(AppPushMQ.IMQReceiver.class)
|
||||
public class AppPushRabbitMQReceiver implements IMQMsgReceiver {
|
||||
|
||||
@Autowired
|
||||
private AppPushMQ.IMQReceiver mqReceiver;
|
||||
|
||||
/** 接收 【 MQSendTypeEnum.QUEUE 】 类型的消息 **/
|
||||
@Override
|
||||
@Async(MqThreadExecutor.EXECUTOR_APP_PUSH)
|
||||
@RabbitListener(queues = AppPushMQ.MQ_NAME)
|
||||
public void receiveMsg(String msg){
|
||||
mqReceiver.receive(AppPushMQ.parse(msg));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.jeequan.jeepay.components.mq.vender.rabbitmq.receive;
|
||||
|
||||
import com.jeequan.jeepay.components.mq.constant.MQVenderCS;
|
||||
import com.jeequan.jeepay.components.mq.executor.MqThreadExecutor;
|
||||
import com.jeequan.jeepay.components.mq.model.CleanAgentLoginAuthCacheMQ;
|
||||
import com.jeequan.jeepay.components.mq.vender.IMQMsgReceiver;
|
||||
import org.springframework.amqp.rabbit.annotation.RabbitListener;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* rabbitMQ消息接收器:仅在vender=rabbitMQ时 && 项目实现IMQReceiver接口时 进行实例化
|
||||
* 业务: 清除商户登录信息
|
||||
*
|
||||
* @author terrfly
|
||||
* @date 2021/7/22 17:06
|
||||
*/
|
||||
@Component
|
||||
@ConditionalOnProperty(name = MQVenderCS.YML_VENDER_KEY, havingValue = MQVenderCS.RABBIT_MQ)
|
||||
@ConditionalOnBean(CleanAgentLoginAuthCacheMQ.IMQReceiver.class)
|
||||
public class CleanAgentLoginAuthCacheRabbitMQReceiver implements IMQMsgReceiver {
|
||||
|
||||
@Autowired
|
||||
private CleanAgentLoginAuthCacheMQ.IMQReceiver mqReceiver;
|
||||
|
||||
/** 接收 【 queue 】 类型的消息 **/
|
||||
@Override
|
||||
@Async(MqThreadExecutor.EXECUTOR_COMMON)
|
||||
@RabbitListener(queues = CleanAgentLoginAuthCacheMQ.MQ_NAME)
|
||||
public void receiveMsg(String msg){
|
||||
mqReceiver.receive(CleanAgentLoginAuthCacheMQ.parse(msg));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.jeequan.jeepay.components.mq.vender.rabbitmq.receive;
|
||||
|
||||
import com.jeequan.jeepay.components.mq.constant.MQVenderCS;
|
||||
import com.jeequan.jeepay.components.mq.executor.MqThreadExecutor;
|
||||
import com.jeequan.jeepay.components.mq.model.CleanMchLoginAuthCacheMQ;
|
||||
import com.jeequan.jeepay.components.mq.vender.IMQMsgReceiver;
|
||||
import org.springframework.amqp.rabbit.annotation.RabbitListener;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* rabbitMQ消息接收器:仅在vender=rabbitMQ时 && 项目实现IMQReceiver接口时 进行实例化
|
||||
* 业务: 清除商户登录信息
|
||||
*
|
||||
* @author terrfly
|
||||
* @date 2021/7/22 17:06
|
||||
*/
|
||||
@Component
|
||||
@ConditionalOnProperty(name = MQVenderCS.YML_VENDER_KEY, havingValue = MQVenderCS.RABBIT_MQ)
|
||||
@ConditionalOnBean(CleanMchLoginAuthCacheMQ.IMQReceiver.class)
|
||||
public class CleanMchLoginAuthCacheRabbitMQReceiver implements IMQMsgReceiver {
|
||||
|
||||
@Autowired
|
||||
private CleanMchLoginAuthCacheMQ.IMQReceiver mqReceiver;
|
||||
|
||||
/** 接收 【 queue 】 类型的消息 **/
|
||||
@Override
|
||||
@Async(MqThreadExecutor.EXECUTOR_COMMON)
|
||||
@RabbitListener(queues = CleanMchLoginAuthCacheMQ.MQ_NAME)
|
||||
public void receiveMsg(String msg){
|
||||
mqReceiver.receive(CleanMchLoginAuthCacheMQ.parse(msg));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package com.jeequan.jeepay.components.mq.vender.rabbitmq.receive;
|
||||
|
||||
import com.jeequan.jeepay.components.mq.constant.MQVenderCS;
|
||||
import com.jeequan.jeepay.components.mq.executor.MqThreadExecutor;
|
||||
import com.jeequan.jeepay.components.mq.model.MchAuditNotifyMQ;
|
||||
import com.jeequan.jeepay.components.mq.vender.IMQMsgReceiver;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.amqp.rabbit.annotation.RabbitListener;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
@ConditionalOnProperty(name = MQVenderCS.YML_VENDER_KEY, havingValue = MQVenderCS.RABBIT_MQ)
|
||||
@ConditionalOnBean(MchAuditNotifyMQ.IMQReceiver.class)
|
||||
public class MchAuditNotifyRabbitMQReceiver implements IMQMsgReceiver {
|
||||
|
||||
@Autowired
|
||||
private MchAuditNotifyMQ.IMQReceiver mqReceiver;
|
||||
|
||||
/** 接收 【 MQSendTypeEnum.QUEUE 】 类型的消息 **/
|
||||
@Override
|
||||
@Async(MqThreadExecutor.EXECUTOR_MCH_AUDIT)
|
||||
@RabbitListener(queues = MchAuditNotifyMQ.MQ_NAME)
|
||||
public void receiveMsg(String msg){
|
||||
log.info("收到进件通道数据, {}", msg);
|
||||
mqReceiver.receive(MchAuditNotifyMQ.parse(msg));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.jeequan.jeepay.components.mq.vender.rabbitmq.receive;
|
||||
|
||||
import com.jeequan.jeepay.components.mq.constant.MQVenderCS;
|
||||
import com.jeequan.jeepay.components.mq.executor.MqThreadExecutor;
|
||||
import com.jeequan.jeepay.components.mq.model.MchAuditMQ;
|
||||
import com.jeequan.jeepay.components.mq.vender.IMQMsgReceiver;
|
||||
import org.springframework.amqp.rabbit.annotation.RabbitListener;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
@ConditionalOnProperty(name = MQVenderCS.YML_VENDER_KEY, havingValue = MQVenderCS.RABBIT_MQ)
|
||||
@ConditionalOnBean(MchAuditMQ.IMQReceiver.class)
|
||||
public class MchAuditRabbitMQReceiver implements IMQMsgReceiver {
|
||||
|
||||
@Autowired
|
||||
private MchAuditMQ.IMQReceiver mqReceiver;
|
||||
|
||||
/** 接收 【 MQSendTypeEnum.QUEUE 】 类型的消息 **/
|
||||
@Override
|
||||
@Async(MqThreadExecutor.EXECUTOR_MCH_AUDIT)
|
||||
@RabbitListener(queues = MchAuditMQ.MQ_NAME)
|
||||
public void receiveMsg(String msg){
|
||||
mqReceiver.receive(MchAuditMQ.parse(msg));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package com.jeequan.jeepay.components.mq.vender.rabbitmq.receive;
|
||||
|
||||
import com.jeequan.jeepay.components.mq.constant.MQVenderCS;
|
||||
import com.jeequan.jeepay.components.mq.executor.MqThreadExecutor;
|
||||
import com.jeequan.jeepay.components.mq.model.MchAuditThirdNotifyMQ;
|
||||
import com.jeequan.jeepay.components.mq.vender.IMQMsgReceiver;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.amqp.rabbit.annotation.RabbitListener;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
@ConditionalOnProperty(name = MQVenderCS.YML_VENDER_KEY, havingValue = MQVenderCS.RABBIT_MQ)
|
||||
@ConditionalOnBean(MchAuditThirdNotifyMQ.IMQReceiver.class)
|
||||
public class MchAuditThirdNotifyRabbitMQReceiver implements IMQMsgReceiver {
|
||||
|
||||
@Autowired
|
||||
private MchAuditThirdNotifyMQ.IMQReceiver mqReceiver;
|
||||
|
||||
/** 接收 【 MQSendTypeEnum.QUEUE 】 类型的消息 **/
|
||||
@Override
|
||||
@Async(MqThreadExecutor.EXECUTOR_MCH_AUDIT)
|
||||
@RabbitListener(queues = MchAuditThirdNotifyMQ.MQ_NAME)
|
||||
public void receiveMsg(String msg){
|
||||
log.info("收到商户信息回调的推送, {}", msg);
|
||||
mqReceiver.receive(MchAuditThirdNotifyMQ.parse(msg));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.jeequan.jeepay.components.mq.vender.rabbitmq.receive;
|
||||
|
||||
import com.jeequan.jeepay.components.mq.constant.MQVenderCS;
|
||||
import com.jeequan.jeepay.components.mq.executor.MqThreadExecutor;
|
||||
import com.jeequan.jeepay.components.mq.model.PayOrderCashoutMQ;
|
||||
import com.jeequan.jeepay.components.mq.vender.IMQMsgReceiver;
|
||||
import org.springframework.amqp.rabbit.annotation.RabbitListener;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* rabbitMQ消息接收器:仅在vender=rabbitMQ时 && 项目实现IMQReceiver接口时 进行实例化
|
||||
* 业务:订单支付成功自动提现
|
||||
*
|
||||
* @author xiaoyu
|
||||
* @date 2021/7/22 17:06
|
||||
*/
|
||||
@Component
|
||||
@ConditionalOnProperty(name = MQVenderCS.YML_VENDER_KEY, havingValue = MQVenderCS.RABBIT_MQ)
|
||||
@ConditionalOnBean(PayOrderCashoutMQ.IMQReceiver.class)
|
||||
public class PayOrderCashoutRabbitMQReceiver implements IMQMsgReceiver {
|
||||
|
||||
@Autowired
|
||||
private PayOrderCashoutMQ.IMQReceiver mqReceiver;
|
||||
|
||||
/** 接收 【 queue 】 类型的消息 **/
|
||||
@Override
|
||||
@Async(MqThreadExecutor.EXECUTOR_PAY_ORDER_CASHOUT)
|
||||
@RabbitListener(queues = PayOrderCashoutMQ.MQ_NAME)
|
||||
public void receiveMsg(String msg){
|
||||
mqReceiver.receive(PayOrderCashoutMQ.parse(msg));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.jeequan.jeepay.components.mq.vender.rabbitmq.receive;
|
||||
|
||||
import com.jeequan.jeepay.components.mq.constant.MQVenderCS;
|
||||
import com.jeequan.jeepay.components.mq.executor.MqThreadExecutor;
|
||||
import com.jeequan.jeepay.components.mq.model.PayOrderDivisionMQ;
|
||||
import com.jeequan.jeepay.components.mq.vender.IMQMsgReceiver;
|
||||
import org.springframework.amqp.rabbit.annotation.RabbitListener;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* rabbitMQ消息接收器:仅在vender=rabbitMQ时 && 项目实现IMQReceiver接口时 进行实例化
|
||||
* 业务: 支付订单分账通知
|
||||
*
|
||||
* @author terrfly
|
||||
* @date 2021/8/22 16:43
|
||||
*/
|
||||
@Component
|
||||
@ConditionalOnProperty(name = MQVenderCS.YML_VENDER_KEY, havingValue = MQVenderCS.RABBIT_MQ)
|
||||
@ConditionalOnBean(PayOrderDivisionMQ.IMQReceiver.class)
|
||||
public class PayOrderDivisionRabbitMQReceiver implements IMQMsgReceiver {
|
||||
|
||||
@Autowired
|
||||
private PayOrderDivisionMQ.IMQReceiver mqReceiver;
|
||||
|
||||
/** 接收 【 queue 】 类型的消息 **/
|
||||
@Override
|
||||
@Async(MqThreadExecutor.EXECUTOR_PAY_ORDER_DIVISION)
|
||||
@RabbitListener(queues = PayOrderDivisionMQ.MQ_NAME)
|
||||
public void receiveMsg(String msg){
|
||||
mqReceiver.receive(PayOrderDivisionMQ.parse(msg));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package com.jeequan.jeepay.components.mq.vender.rabbitmq.receive;
|
||||
|
||||
import com.jeequan.jeepay.components.mq.constant.MQVenderCS;
|
||||
import com.jeequan.jeepay.components.mq.executor.MqThreadExecutor;
|
||||
import com.jeequan.jeepay.components.mq.model.AccountBalanceMQ;
|
||||
import com.jeequan.jeepay.components.mq.model.PayOrderMarketMQ;
|
||||
import com.jeequan.jeepay.components.mq.vender.IMQMsgReceiver;
|
||||
import org.springframework.amqp.rabbit.annotation.RabbitListener;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* TODO
|
||||
*
|
||||
* @author crystal
|
||||
* @date 2024/1/29 16:20
|
||||
*/
|
||||
@Component
|
||||
@ConditionalOnProperty(name = MQVenderCS.YML_VENDER_KEY, havingValue = MQVenderCS.RABBIT_MQ)
|
||||
@ConditionalOnBean(PayOrderMarketMQ.IMQReceiver.class)
|
||||
public class PayOrderMarketRabbitMQReceiver implements IMQMsgReceiver {
|
||||
|
||||
@Autowired
|
||||
private PayOrderMarketMQ.IMQReceiver mqReceiver;
|
||||
|
||||
/** 接收 【 MQSendTypeEnum.QUEUE 】 类型的消息 **/
|
||||
@Override
|
||||
@Async(MqThreadExecutor.EXECUTOR_PAY_ORDER_MARKET)
|
||||
@RabbitListener(queues = PayOrderMarketMQ.MQ_NAME)
|
||||
public void receiveMsg(String msg){
|
||||
mqReceiver.receive(PayOrderMarketMQ.parse(msg));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.jeequan.jeepay.components.mq.vender.rabbitmq.receive;
|
||||
|
||||
import com.jeequan.jeepay.components.mq.constant.MQVenderCS;
|
||||
import com.jeequan.jeepay.components.mq.executor.MqThreadExecutor;
|
||||
import com.jeequan.jeepay.components.mq.model.PayOrderMchNotifyMQ;
|
||||
import com.jeequan.jeepay.components.mq.vender.IMQMsgReceiver;
|
||||
import org.springframework.amqp.rabbit.annotation.RabbitListener;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* rabbitMQ消息接收器:仅在vender=rabbitMQ时 && 项目实现IMQReceiver接口时 进行实例化
|
||||
* 业务: 支付订单商户通知
|
||||
*
|
||||
* @author terrfly
|
||||
* @date 2021/7/22 17:06
|
||||
*/
|
||||
@Component
|
||||
@ConditionalOnProperty(name = MQVenderCS.YML_VENDER_KEY, havingValue = MQVenderCS.RABBIT_MQ)
|
||||
@ConditionalOnBean(PayOrderMchNotifyMQ.IMQReceiver.class)
|
||||
public class PayOrderMchNotifyRabbitMQReceiver implements IMQMsgReceiver {
|
||||
|
||||
@Autowired
|
||||
private PayOrderMchNotifyMQ.IMQReceiver mqReceiver;
|
||||
|
||||
/** 接收 【 queue 】 类型的消息 **/
|
||||
@Override
|
||||
@Async(MqThreadExecutor.EXECUTOR_PAY_ORDER_MCH_NOTIFY)
|
||||
@RabbitListener(queues = PayOrderMchNotifyMQ.MQ_NAME)
|
||||
public void receiveMsg(String msg){
|
||||
mqReceiver.receive(PayOrderMchNotifyMQ.parse(msg));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.jeequan.jeepay.components.mq.vender.rabbitmq.receive;
|
||||
|
||||
import com.jeequan.jeepay.components.mq.constant.MQVenderCS;
|
||||
import com.jeequan.jeepay.components.mq.executor.MqThreadExecutor;
|
||||
import com.jeequan.jeepay.components.mq.model.PayOrderReissueMQ;
|
||||
import com.jeequan.jeepay.components.mq.vender.IMQMsgReceiver;
|
||||
import org.springframework.amqp.rabbit.annotation.RabbitListener;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* rabbitMQ消息接收器:仅在vender=rabbitMQ时 && 项目实现IMQReceiver接口时 进行实例化
|
||||
* 业务: 支付订单补单(一般用于没有回调的接口,比如微信的条码支付)
|
||||
*
|
||||
* @author terrfly
|
||||
* @date 2021/7/22 17:06
|
||||
*/
|
||||
@Component
|
||||
@ConditionalOnProperty(name = MQVenderCS.YML_VENDER_KEY, havingValue = MQVenderCS.RABBIT_MQ)
|
||||
@ConditionalOnBean(PayOrderReissueMQ.IMQReceiver.class)
|
||||
public class PayOrderReissueRabbitMQReceiver implements IMQMsgReceiver {
|
||||
|
||||
@Autowired
|
||||
private PayOrderReissueMQ.IMQReceiver mqReceiver;
|
||||
|
||||
/** 接收 【 queue 】 类型的消息 **/
|
||||
@Override
|
||||
@Async(MqThreadExecutor.EXECUTOR_PAY_ORDER_REISSUE)
|
||||
@RabbitListener(queues = PayOrderReissueMQ.MQ_NAME)
|
||||
public void receiveMsg(String msg){
|
||||
mqReceiver.receive(PayOrderReissueMQ.parse(msg));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.jeequan.jeepay.components.mq.vender.rabbitmq.receive;
|
||||
|
||||
import com.jeequan.jeepay.components.mq.constant.MQVenderCS;
|
||||
import com.jeequan.jeepay.components.mq.executor.MqThreadExecutor;
|
||||
import com.jeequan.jeepay.components.mq.model.PushPrinterMQ;
|
||||
import com.jeequan.jeepay.components.mq.vender.IMQMsgReceiver;
|
||||
import org.springframework.amqp.rabbit.annotation.RabbitListener;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* abbitMQ消息接收器:仅在vender=rabbitMQ时 && 项目实现IMQReceiver接口时 进行实例化
|
||||
* 业务: 云打印推送
|
||||
*
|
||||
* @author terrfly
|
||||
* @date 2021/7/22 17:06
|
||||
*/
|
||||
@Component
|
||||
@ConditionalOnProperty(name = MQVenderCS.YML_VENDER_KEY, havingValue = MQVenderCS.RABBIT_MQ)
|
||||
@ConditionalOnBean(PushPrinterMQ.IMQReceiver.class)
|
||||
public class PushPrinterRabbitMQReceiver implements IMQMsgReceiver {
|
||||
|
||||
@Autowired
|
||||
private PushPrinterMQ.IMQReceiver mqReceiver;
|
||||
|
||||
/** 接收 【 MQSendTypeEnum.QUEUE 】 类型的消息 **/
|
||||
@Override
|
||||
@Async(MqThreadExecutor.EXECUTOR_PUSH_PRINTER)
|
||||
@RabbitListener(queues = PushPrinterMQ.MQ_NAME)
|
||||
public void receiveMsg(String msg){
|
||||
mqReceiver.receive(PushPrinterMQ.parse(msg));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.jeequan.jeepay.components.mq.vender.rabbitmq.receive;
|
||||
|
||||
import com.jeequan.jeepay.components.mq.constant.MQVenderCS;
|
||||
import com.jeequan.jeepay.components.mq.executor.MqThreadExecutor;
|
||||
import com.jeequan.jeepay.components.mq.model.PushSpeakerMQ;
|
||||
import com.jeequan.jeepay.components.mq.vender.IMQMsgReceiver;
|
||||
import org.springframework.amqp.rabbit.annotation.RabbitListener;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* abbitMQ消息接收器:仅在vender=rabbitMQ时 && 项目实现IMQReceiver接口时 进行实例化
|
||||
* 业务: 云喇叭推送
|
||||
*
|
||||
* @author terrfly
|
||||
* @date 2021/7/22 17:06
|
||||
*/
|
||||
@Component
|
||||
@ConditionalOnProperty(name = MQVenderCS.YML_VENDER_KEY, havingValue = MQVenderCS.RABBIT_MQ)
|
||||
@ConditionalOnBean(PushSpeakerMQ.IMQReceiver.class)
|
||||
public class PushSpeakerRabbitMQReceiver implements IMQMsgReceiver {
|
||||
|
||||
@Autowired
|
||||
private PushSpeakerMQ.IMQReceiver mqReceiver;
|
||||
|
||||
/** 接收 【 MQSendTypeEnum.QUEUE 】 类型的消息 **/
|
||||
@Override
|
||||
@Async(MqThreadExecutor.EXECUTOR_PUSH_SPEAKER)
|
||||
@RabbitListener(queues = PushSpeakerMQ.MQ_NAME)
|
||||
public void receiveMsg(String msg){
|
||||
mqReceiver.receive(PushSpeakerMQ.parse(msg));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.jeequan.jeepay.components.mq.vender.rabbitmq.receive;
|
||||
|
||||
import com.jeequan.jeepay.components.mq.constant.MQVenderCS;
|
||||
import com.jeequan.jeepay.components.mq.executor.MqThreadExecutor;
|
||||
import com.jeequan.jeepay.components.mq.model.PushWxMpMsgMQ;
|
||||
import com.jeequan.jeepay.components.mq.vender.IMQMsgReceiver;
|
||||
import org.springframework.amqp.rabbit.annotation.RabbitListener;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* abbitMQ消息接收器:仅在vender=rabbitMQ时 && 项目实现IMQReceiver接口时 进行实例化
|
||||
* 业务: 微信公众号通知
|
||||
*
|
||||
* @author terrfly
|
||||
* @date 2021/7/22 17:06
|
||||
*/
|
||||
@Component
|
||||
@ConditionalOnProperty(name = MQVenderCS.YML_VENDER_KEY, havingValue = MQVenderCS.RABBIT_MQ)
|
||||
@ConditionalOnBean(PushWxMpMsgMQ.IMQReceiver.class)
|
||||
public class PushWxMpMsgRabbitMQReceiver implements IMQMsgReceiver {
|
||||
|
||||
@Autowired
|
||||
private PushWxMpMsgMQ.IMQReceiver mqReceiver;
|
||||
|
||||
/** 接收 【 MQSendTypeEnum.QUEUE 】 类型的消息 **/
|
||||
@Override
|
||||
@Async(MqThreadExecutor.EXECUTOR_PUSH_MP_MSG)
|
||||
@RabbitListener(queues = PushWxMpMsgMQ.MQ_NAME)
|
||||
public void receiveMsg(String msg){
|
||||
mqReceiver.receive(PushWxMpMsgMQ.parse(msg));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
package com.jeequan.jeepay.components.mq.vender.rabbitmq.receive;
|
||||
|
||||
import com.jeequan.jeepay.components.mq.constant.MQVenderCS;
|
||||
import com.jeequan.jeepay.components.mq.model.ResetAppConfigMQ;
|
||||
import com.jeequan.jeepay.components.mq.vender.IMQMsgReceiver;
|
||||
import com.jeequan.jeepay.components.mq.vender.rabbitmq.RabbitMQConfig;
|
||||
import org.springframework.amqp.core.ExchangeTypes;
|
||||
import org.springframework.amqp.rabbit.annotation.Exchange;
|
||||
import org.springframework.amqp.rabbit.annotation.Queue;
|
||||
import org.springframework.amqp.rabbit.annotation.QueueBinding;
|
||||
import org.springframework.amqp.rabbit.annotation.RabbitListener;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* rabbitMQ消息接收器:仅在vender=rabbitMQ时 && 项目实现IMQReceiver接口时 进行实例化
|
||||
* 业务: 更新系统配置参数
|
||||
*
|
||||
* @author terrfly
|
||||
* @date 2021/7/22 17:06
|
||||
*/
|
||||
@Component
|
||||
@ConditionalOnProperty(name = MQVenderCS.YML_VENDER_KEY, havingValue = MQVenderCS.RABBIT_MQ)
|
||||
@ConditionalOnBean(ResetAppConfigMQ.IMQReceiver.class)
|
||||
public class ResetAppConfigRabbitMQReceiver implements IMQMsgReceiver {
|
||||
|
||||
@Autowired
|
||||
private ResetAppConfigMQ.IMQReceiver mqReceiver;
|
||||
|
||||
/**
|
||||
* 接收 【 MQSendTypeEnum.BROADCAST 】 广播类型的消息
|
||||
* <p>
|
||||
* 注意:
|
||||
* RabbitMQ的广播模式(fanout)交换机 --》全部的Queue
|
||||
* 如果queue包含多个消费者, 【例如,manager和payment的监听器是名称相同的queue下的消费者(Consumers) 】, 两个消费者是工作模式且存在竞争关系, 导致只能一个来消费。
|
||||
* 解决:
|
||||
* 每个topic的QUEUE都声明一个FANOUT交换机, 消费者声明一个系统产生的【随机队列】绑定到这个交换机上,然后往交换机发消息,只要绑定到这个交换机上都能收到消息。
|
||||
* 参考: https://bbs.csdn.net/topics/392509262?list=70088931
|
||||
**/
|
||||
@Override
|
||||
@RabbitListener(
|
||||
bindings = {@QueueBinding(value = @Queue(), // 注意这里不要定义队列名称,系统会随机产生
|
||||
exchange = @Exchange(name = RabbitMQConfig.FANOUT_EXCHANGE_NAME_PREFIX + ResetAppConfigMQ.MQ_NAME,
|
||||
type = ExchangeTypes.FANOUT))})
|
||||
public void receiveMsg(String msg) {
|
||||
mqReceiver.receive(ResetAppConfigMQ.parse(msg));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
package com.jeequan.jeepay.components.mq.vender.rabbitmq.receive;
|
||||
|
||||
import com.jeequan.jeepay.components.mq.constant.MQVenderCS;
|
||||
import com.jeequan.jeepay.components.mq.model.ResetIsvMchAppInfoConfigMQ;
|
||||
import com.jeequan.jeepay.components.mq.vender.IMQMsgReceiver;
|
||||
import com.jeequan.jeepay.components.mq.vender.rabbitmq.RabbitMQConfig;
|
||||
import org.springframework.amqp.core.ExchangeTypes;
|
||||
import org.springframework.amqp.rabbit.annotation.Exchange;
|
||||
import org.springframework.amqp.rabbit.annotation.Queue;
|
||||
import org.springframework.amqp.rabbit.annotation.QueueBinding;
|
||||
import org.springframework.amqp.rabbit.annotation.RabbitListener;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* rabbitMQ消息接收器:仅在vender=rabbitMQ时 && 项目实现IMQReceiver接口时 进行实例化
|
||||
* 业务: 更新服务商/商户/商户应用配置信息
|
||||
*
|
||||
* @author terrfly
|
||||
* @date 2021/7/22 17:06
|
||||
*/
|
||||
@Component
|
||||
@ConditionalOnProperty(name = MQVenderCS.YML_VENDER_KEY, havingValue = MQVenderCS.RABBIT_MQ)
|
||||
@ConditionalOnBean(ResetIsvMchAppInfoConfigMQ.IMQReceiver.class)
|
||||
public class ResetIsvMchAppInfoRabbitMQReceiver implements IMQMsgReceiver {
|
||||
|
||||
@Autowired
|
||||
private ResetIsvMchAppInfoConfigMQ.IMQReceiver mqReceiver;
|
||||
|
||||
/**
|
||||
* 接收 【 MQSendTypeEnum.BROADCAST 】 广播类型的消息
|
||||
* <p>
|
||||
* 注意:
|
||||
* RabbitMQ的广播模式(fanout)交换机 --》全部的Queue
|
||||
* 如果queue包含多个消费者, 【例如,manager和payment的监听器是名称相同的queue下的消费者(Consumers) 】, 两个消费者是工作模式且存在竞争关系, 导致只能一个来消费。
|
||||
* 解决:
|
||||
* 每个topic的QUEUE都声明一个FANOUT交换机, 消费者声明一个系统产生的【随机队列】绑定到这个交换机上,然后往交换机发消息,只要绑定到这个交换机上都能收到消息。
|
||||
* 参考: https://bbs.csdn.net/topics/392509262?list=70088931
|
||||
**/
|
||||
@Override
|
||||
@RabbitListener(
|
||||
bindings = {@QueueBinding(value = @Queue(), // 注意这里不要定义队列名称,系统会随机产生
|
||||
exchange = @Exchange(name = RabbitMQConfig.FANOUT_EXCHANGE_NAME_PREFIX + ResetIsvMchAppInfoConfigMQ.MQ_NAME,
|
||||
type = ExchangeTypes.FANOUT))})
|
||||
public void receiveMsg(String msg) {
|
||||
mqReceiver.receive(ResetIsvMchAppInfoConfigMQ.parse(msg));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.jeequan.jeepay.components.mq.vender.rabbitmq.receive;
|
||||
|
||||
import com.jeequan.jeepay.components.mq.constant.MQVenderCS;
|
||||
import com.jeequan.jeepay.components.mq.executor.MqThreadExecutor;
|
||||
import com.jeequan.jeepay.components.mq.model.ZftSettOrderMQ;
|
||||
import com.jeequan.jeepay.components.mq.vender.IMQMsgReceiver;
|
||||
import org.springframework.amqp.rabbit.annotation.RabbitListener;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* rabbitMQ消息接收器:仅在vender=rabbitMQ时 && 项目实现IMQReceiver接口时 进行实例化
|
||||
* 业务: 直付通订单结算通知
|
||||
*
|
||||
* @author xiaoyu
|
||||
* @date 2021/7/22 17:06
|
||||
*/
|
||||
@Component
|
||||
@ConditionalOnProperty(name = MQVenderCS.YML_VENDER_KEY, havingValue = MQVenderCS.RABBIT_MQ)
|
||||
@ConditionalOnBean(ZftSettOrderMQ.IMQReceiver.class)
|
||||
public class ZftSettOrderRabbitMQReceiver implements IMQMsgReceiver {
|
||||
|
||||
@Autowired
|
||||
private ZftSettOrderMQ.IMQReceiver mqReceiver;
|
||||
|
||||
/** 接收 【 queue 】 类型的消息 **/
|
||||
@Override
|
||||
@Async(MqThreadExecutor.EXECUTOR_ZFT_SETT_ORDER)
|
||||
@RabbitListener(queues = ZftSettOrderMQ.MQ_NAME)
|
||||
public void receiveMsg(String msg){
|
||||
mqReceiver.receive(ZftSettOrderMQ.parse(msg));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
package com.jeequan.jeepay.components.mq.vender.rocketmq;
|
||||
|
||||
import com.jeequan.jeepay.components.mq.constant.MQVenderCS;
|
||||
import com.jeequan.jeepay.components.mq.model.AbstractMQ;
|
||||
import com.jeequan.jeepay.components.mq.vender.IMQSender;
|
||||
import org.apache.rocketmq.spring.core.RocketMQTemplate;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.messaging.support.MessageBuilder;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.TreeMap;
|
||||
|
||||
/**
|
||||
* rocketMQ 消息发送器的实现
|
||||
*
|
||||
* @author terrfly
|
||||
* @date 2021/7/26 11:52
|
||||
*/
|
||||
@Component
|
||||
@ConditionalOnProperty(name = MQVenderCS.YML_VENDER_KEY, havingValue = MQVenderCS.ROCKET_MQ)
|
||||
public class RocketMQSender implements IMQSender {
|
||||
|
||||
private static final List<Integer> DELAY_TIME_LEVEL = new ArrayList<>();
|
||||
static{
|
||||
// 预设值的延迟时间间隔为:1s、 5s、 10s、 30s、 1m、 2m、 3m、 4m、 5m、 6m、 7m、 8m、 9m、 10m、 20m、 30m、 1h、 2h
|
||||
DELAY_TIME_LEVEL.add(1);
|
||||
DELAY_TIME_LEVEL.add(5);
|
||||
DELAY_TIME_LEVEL.add(10);
|
||||
DELAY_TIME_LEVEL.add(30);
|
||||
DELAY_TIME_LEVEL.add(60 * 1);
|
||||
DELAY_TIME_LEVEL.add(60 * 2);
|
||||
DELAY_TIME_LEVEL.add(60 * 3);
|
||||
DELAY_TIME_LEVEL.add(60 * 4);
|
||||
DELAY_TIME_LEVEL.add(60 * 5);
|
||||
DELAY_TIME_LEVEL.add(60 * 6);
|
||||
DELAY_TIME_LEVEL.add(60 * 7);
|
||||
DELAY_TIME_LEVEL.add(60 * 8);
|
||||
DELAY_TIME_LEVEL.add(60 * 9);
|
||||
DELAY_TIME_LEVEL.add(60 * 10);
|
||||
DELAY_TIME_LEVEL.add(60 * 20);
|
||||
DELAY_TIME_LEVEL.add(60 * 30);
|
||||
DELAY_TIME_LEVEL.add(60 * 60 * 1);
|
||||
DELAY_TIME_LEVEL.add(60 * 60 * 2);
|
||||
}
|
||||
|
||||
@Autowired private RocketMQTemplate rocketMQTemplate;
|
||||
|
||||
@Override
|
||||
public void send(AbstractMQ mqModel) {
|
||||
rocketMQTemplate.convertAndSend(mqModel.getMQName(), mqModel.toMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void send(AbstractMQ mqModel, int delay) {
|
||||
// RocketMQ不支持自定义延迟时间, 需要根据传入的参数进行最近的匹配。
|
||||
rocketMQTemplate.syncSend(mqModel.getMQName(), MessageBuilder.withPayload(mqModel.toMessage()).build(),300000, getNearDelayLevel(delay));
|
||||
}
|
||||
|
||||
/** 获取最接近的节点值 **/
|
||||
private int getNearDelayLevel(int delay){
|
||||
|
||||
// 如果包含则直接返回
|
||||
if(DELAY_TIME_LEVEL.contains(delay)){
|
||||
return DELAY_TIME_LEVEL.indexOf(delay) + 1;
|
||||
}
|
||||
|
||||
//两个时间的绝对值 - 位置
|
||||
TreeMap<Integer, Integer> resultMap = new TreeMap<>();
|
||||
DELAY_TIME_LEVEL.stream().forEach(time -> resultMap.put(Math.abs(delay - time), DELAY_TIME_LEVEL.indexOf(time) + 1));
|
||||
return resultMap.firstEntry().getValue();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package com.jeequan.jeepay.components.mq.vender.rocketmq.receive;
|
||||
|
||||
import com.jeequan.jeepay.components.mq.constant.MQVenderCS;
|
||||
import com.jeequan.jeepay.components.mq.executor.MqThreadExecutor;
|
||||
import com.jeequan.jeepay.components.mq.model.AccountBalanceMQ;
|
||||
import com.jeequan.jeepay.components.mq.vender.IMQMsgReceiver;
|
||||
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
|
||||
import org.apache.rocketmq.spring.core.RocketMQListener;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* rocketMQ消息接收器:仅在vender=rocketMQ时 && 项目实现IMQReceiver接口时 进行实例化
|
||||
* 业务: app推送
|
||||
*
|
||||
* @author terrfly
|
||||
* @date 2021/7/22 17:06
|
||||
*/
|
||||
@Component
|
||||
@ConditionalOnProperty(name = MQVenderCS.YML_VENDER_KEY, havingValue = MQVenderCS.ROCKET_MQ)
|
||||
@ConditionalOnBean(AccountBalanceMQ.IMQReceiver.class)
|
||||
@RocketMQMessageListener(topic = AccountBalanceMQ.MQ_NAME, consumerGroup = AccountBalanceMQ.MQ_NAME)
|
||||
public class AccountBalanceRocketMQReceiver implements IMQMsgReceiver, RocketMQListener<String> {
|
||||
|
||||
@Autowired
|
||||
private AccountBalanceMQ.IMQReceiver mqReceiver;
|
||||
|
||||
/** 接收 【 queue 】 类型的消息 **/
|
||||
@Override
|
||||
public void receiveMsg(String msg){
|
||||
mqReceiver.receive(AccountBalanceMQ.parse(msg));
|
||||
}
|
||||
|
||||
@Override
|
||||
@Async(MqThreadExecutor.EXECUTOR_ACCOUNT_BALANCE)
|
||||
public void onMessage(String message) { this.receiveMsg(message); }
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package com.jeequan.jeepay.components.mq.vender.rocketmq.receive;
|
||||
|
||||
import com.jeequan.jeepay.components.mq.constant.MQVenderCS;
|
||||
import com.jeequan.jeepay.components.mq.executor.MqThreadExecutor;
|
||||
import com.jeequan.jeepay.components.mq.model.AppPushMQ;
|
||||
import com.jeequan.jeepay.components.mq.vender.IMQMsgReceiver;
|
||||
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
|
||||
import org.apache.rocketmq.spring.core.RocketMQListener;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* rocketMQ消息接收器:仅在vender=rocketMQ时 && 项目实现IMQReceiver接口时 进行实例化
|
||||
* 业务: app推送
|
||||
*
|
||||
* @author terrfly
|
||||
* @date 2021/7/22 17:06
|
||||
*/
|
||||
@Component
|
||||
@ConditionalOnProperty(name = MQVenderCS.YML_VENDER_KEY, havingValue = MQVenderCS.ROCKET_MQ)
|
||||
@ConditionalOnBean(AppPushMQ.IMQReceiver.class)
|
||||
@RocketMQMessageListener(topic = AppPushMQ.MQ_NAME, consumerGroup = AppPushMQ.MQ_NAME)
|
||||
public class AppPushRocketMQReceiver implements IMQMsgReceiver, RocketMQListener<String> {
|
||||
|
||||
@Autowired
|
||||
private AppPushMQ.IMQReceiver mqReceiver;
|
||||
|
||||
/** 接收 【 queue 】 类型的消息 **/
|
||||
@Override
|
||||
public void receiveMsg(String msg){
|
||||
mqReceiver.receive(AppPushMQ.parse(msg));
|
||||
}
|
||||
|
||||
@Override
|
||||
@Async(MqThreadExecutor.EXECUTOR_APP_PUSH)
|
||||
public void onMessage(String message) { this.receiveMsg(message); }
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
package com.jeequan.jeepay.components.mq.vender.rocketmq.receive;
|
||||
|
||||
import com.jeequan.jeepay.components.mq.constant.MQVenderCS;
|
||||
import com.jeequan.jeepay.components.mq.executor.MqThreadExecutor;
|
||||
import com.jeequan.jeepay.components.mq.model.CleanAgentLoginAuthCacheMQ;
|
||||
import com.jeequan.jeepay.components.mq.vender.IMQMsgReceiver;
|
||||
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
|
||||
import org.apache.rocketmq.spring.core.RocketMQListener;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* rocketMQ消息接收器:仅在vender=rocketMQ时 && 项目实现IMQReceiver接口时 进行实例化
|
||||
* 业务: 清除商户登录信息
|
||||
*
|
||||
* @author terrfly
|
||||
* @date 2021/7/22 17:06
|
||||
*/
|
||||
@Component
|
||||
@ConditionalOnProperty(name = MQVenderCS.YML_VENDER_KEY, havingValue = MQVenderCS.ROCKET_MQ)
|
||||
@ConditionalOnBean(CleanAgentLoginAuthCacheMQ.IMQReceiver.class)
|
||||
@RocketMQMessageListener(topic = CleanAgentLoginAuthCacheMQ.MQ_NAME, consumerGroup = CleanAgentLoginAuthCacheMQ.MQ_NAME)
|
||||
public class CleanAgentLoginAuthCacheRocketMQReceiver implements IMQMsgReceiver, RocketMQListener<String> {
|
||||
|
||||
@Autowired
|
||||
private CleanAgentLoginAuthCacheMQ.IMQReceiver mqReceiver;
|
||||
|
||||
/** 接收 【 queue 】 类型的消息 **/
|
||||
@Override
|
||||
public void receiveMsg(String msg){
|
||||
mqReceiver.receive(CleanAgentLoginAuthCacheMQ.parse(msg));
|
||||
}
|
||||
|
||||
@Override
|
||||
@Async(MqThreadExecutor.EXECUTOR_COMMON)
|
||||
public void onMessage(String message) {
|
||||
this.receiveMsg(message);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
package com.jeequan.jeepay.components.mq.vender.rocketmq.receive;
|
||||
|
||||
import com.jeequan.jeepay.components.mq.constant.MQVenderCS;
|
||||
import com.jeequan.jeepay.components.mq.executor.MqThreadExecutor;
|
||||
import com.jeequan.jeepay.components.mq.model.CleanMchLoginAuthCacheMQ;
|
||||
import com.jeequan.jeepay.components.mq.vender.IMQMsgReceiver;
|
||||
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
|
||||
import org.apache.rocketmq.spring.core.RocketMQListener;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* rocketMQ消息接收器:仅在vender=rocketMQ时 && 项目实现IMQReceiver接口时 进行实例化
|
||||
* 业务: 清除商户登录信息
|
||||
*
|
||||
* @author terrfly
|
||||
* @date 2021/7/22 17:06
|
||||
*/
|
||||
@Component
|
||||
@ConditionalOnProperty(name = MQVenderCS.YML_VENDER_KEY, havingValue = MQVenderCS.ROCKET_MQ)
|
||||
@ConditionalOnBean(CleanMchLoginAuthCacheMQ.IMQReceiver.class)
|
||||
@RocketMQMessageListener(topic = CleanMchLoginAuthCacheMQ.MQ_NAME, consumerGroup = CleanMchLoginAuthCacheMQ.MQ_NAME)
|
||||
public class CleanMchLoginAuthCacheRocketMQReceiver implements IMQMsgReceiver, RocketMQListener<String> {
|
||||
|
||||
@Autowired
|
||||
private CleanMchLoginAuthCacheMQ.IMQReceiver mqReceiver;
|
||||
|
||||
/** 接收 【 queue 】 类型的消息 **/
|
||||
@Override
|
||||
public void receiveMsg(String msg){
|
||||
mqReceiver.receive(CleanMchLoginAuthCacheMQ.parse(msg));
|
||||
}
|
||||
|
||||
@Override
|
||||
@Async(MqThreadExecutor.EXECUTOR_COMMON)
|
||||
public void onMessage(String message) {
|
||||
this.receiveMsg(message);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package com.jeequan.jeepay.components.mq.vender.rocketmq.receive;
|
||||
|
||||
import com.jeequan.jeepay.components.mq.constant.MQVenderCS;
|
||||
import com.jeequan.jeepay.components.mq.executor.MqThreadExecutor;
|
||||
import com.jeequan.jeepay.components.mq.model.MchAuditMQ;
|
||||
import com.jeequan.jeepay.components.mq.vender.IMQMsgReceiver;
|
||||
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
|
||||
import org.apache.rocketmq.spring.core.RocketMQListener;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
@ConditionalOnProperty(name = MQVenderCS.YML_VENDER_KEY, havingValue = MQVenderCS.ROCKET_MQ)
|
||||
@ConditionalOnBean(MchAuditMQ.IMQReceiver.class)
|
||||
@RocketMQMessageListener(topic = MchAuditMQ.MQ_NAME, consumerGroup = MchAuditMQ.MQ_NAME)
|
||||
public class MchAuditRocketMQReceiver implements IMQMsgReceiver, RocketMQListener<String> {
|
||||
|
||||
@Autowired
|
||||
private MchAuditMQ.IMQReceiver mqReceiver;
|
||||
|
||||
/** 接收 【 queue 】 类型的消息 **/
|
||||
@Override
|
||||
public void receiveMsg(String msg){
|
||||
mqReceiver.receive(MchAuditMQ.parse(msg));
|
||||
}
|
||||
|
||||
@Override
|
||||
@Async(MqThreadExecutor.EXECUTOR_MCH_AUDIT)
|
||||
public void onMessage(String message) {
|
||||
this.receiveMsg(message);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
package com.jeequan.jeepay.components.mq.vender.rocketmq.receive;
|
||||
|
||||
import com.jeequan.jeepay.components.mq.constant.MQVenderCS;
|
||||
import com.jeequan.jeepay.components.mq.executor.MqThreadExecutor;
|
||||
import com.jeequan.jeepay.components.mq.model.PayOrderCashoutMQ;
|
||||
import com.jeequan.jeepay.components.mq.vender.IMQMsgReceiver;
|
||||
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
|
||||
import org.apache.rocketmq.spring.core.RocketMQListener;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* rocketMQ消息接收器:仅在vender=rocketMQ时 && 项目实现IMQReceiver接口时 进行实例化
|
||||
* 业务: 订单支付成功自动提现
|
||||
*
|
||||
* @author zx
|
||||
* @date 2021/7/22 17:06
|
||||
*/
|
||||
@Component
|
||||
@ConditionalOnProperty(name = MQVenderCS.YML_VENDER_KEY, havingValue = MQVenderCS.ROCKET_MQ)
|
||||
@ConditionalOnBean(PayOrderCashoutMQ.IMQReceiver.class)
|
||||
@RocketMQMessageListener(topic = PayOrderCashoutMQ.MQ_NAME, consumerGroup = PayOrderCashoutMQ.MQ_NAME)
|
||||
public class PayOrderCashoutRocketMQReceiver implements IMQMsgReceiver, RocketMQListener<String> {
|
||||
|
||||
@Autowired
|
||||
private PayOrderCashoutMQ.IMQReceiver mqReceiver;
|
||||
|
||||
/** 接收 【 queue 】 类型的消息 **/
|
||||
@Override
|
||||
public void receiveMsg(String msg){
|
||||
mqReceiver.receive(PayOrderCashoutMQ.parse(msg));
|
||||
}
|
||||
|
||||
@Override
|
||||
@Async(MqThreadExecutor.EXECUTOR_PAY_ORDER_CASHOUT)
|
||||
public void onMessage(String message) {
|
||||
this.receiveMsg(message);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
package com.jeequan.jeepay.components.mq.vender.rocketmq.receive;
|
||||
|
||||
import com.jeequan.jeepay.components.mq.constant.MQVenderCS;
|
||||
import com.jeequan.jeepay.components.mq.executor.MqThreadExecutor;
|
||||
import com.jeequan.jeepay.components.mq.model.PayOrderDivisionMQ;
|
||||
import com.jeequan.jeepay.components.mq.vender.IMQMsgReceiver;
|
||||
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
|
||||
import org.apache.rocketmq.spring.core.RocketMQListener;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* rocketMQ消息接收器:仅在vender=rocketMQ时 && 项目实现IMQReceiver接口时 进行实例化
|
||||
* 业务: 支付订单分账通知
|
||||
*
|
||||
* @author terrfly
|
||||
* @date 2021/8/22 16:43
|
||||
*/
|
||||
@Component
|
||||
@ConditionalOnProperty(name = MQVenderCS.YML_VENDER_KEY, havingValue = MQVenderCS.ROCKET_MQ)
|
||||
@ConditionalOnBean(PayOrderDivisionMQ.IMQReceiver.class)
|
||||
@RocketMQMessageListener(topic = PayOrderDivisionMQ.MQ_NAME, consumerGroup = PayOrderDivisionMQ.MQ_NAME)
|
||||
public class PayOrderDivisionRocketMQReceiver implements IMQMsgReceiver, RocketMQListener<String> {
|
||||
|
||||
@Autowired
|
||||
private PayOrderDivisionMQ.IMQReceiver mqReceiver;
|
||||
|
||||
/** 接收 【 queue 】 类型的消息 **/
|
||||
@Override
|
||||
public void receiveMsg(String msg){
|
||||
mqReceiver.receive(PayOrderDivisionMQ.parse(msg));
|
||||
}
|
||||
|
||||
@Override
|
||||
@Async(MqThreadExecutor.EXECUTOR_PAY_ORDER_DIVISION)
|
||||
public void onMessage(String message) {
|
||||
this.receiveMsg(message);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package com.jeequan.jeepay.components.mq.vender.rocketmq.receive;
|
||||
|
||||
import com.jeequan.jeepay.components.mq.constant.MQVenderCS;
|
||||
import com.jeequan.jeepay.components.mq.executor.MqThreadExecutor;
|
||||
import com.jeequan.jeepay.components.mq.model.PayOrderMarketMQ;
|
||||
import com.jeequan.jeepay.components.mq.vender.IMQMsgReceiver;
|
||||
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
|
||||
import org.apache.rocketmq.spring.core.RocketMQListener;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* TODO
|
||||
*
|
||||
* @author crystal
|
||||
* @date 2024/1/29 16:22
|
||||
*/
|
||||
@Component
|
||||
@ConditionalOnProperty(name = MQVenderCS.YML_VENDER_KEY, havingValue = MQVenderCS.ROCKET_MQ)
|
||||
@ConditionalOnBean(PayOrderMarketMQ.IMQReceiver.class)
|
||||
@RocketMQMessageListener(topic = PayOrderMarketMQ.MQ_NAME, consumerGroup = PayOrderMarketMQ.MQ_NAME)
|
||||
public class PayOrderMarketRocketMqReceiver implements IMQMsgReceiver, RocketMQListener<String> {
|
||||
|
||||
@Autowired
|
||||
private PayOrderMarketMQ.IMQReceiver mqReceiver;
|
||||
|
||||
/** 接收 【 queue 】 类型的消息 **/
|
||||
@Override
|
||||
public void receiveMsg(String msg){
|
||||
mqReceiver.receive(PayOrderMarketMQ.parse(msg));
|
||||
}
|
||||
|
||||
@Override
|
||||
@Async(MqThreadExecutor.EXECUTOR_PAY_ORDER_MARKET)
|
||||
public void onMessage(String message) { this.receiveMsg(message); }
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
package com.jeequan.jeepay.components.mq.vender.rocketmq.receive;
|
||||
|
||||
import com.jeequan.jeepay.components.mq.constant.MQVenderCS;
|
||||
import com.jeequan.jeepay.components.mq.executor.MqThreadExecutor;
|
||||
import com.jeequan.jeepay.components.mq.model.PayOrderMchNotifyMQ;
|
||||
import com.jeequan.jeepay.components.mq.vender.IMQMsgReceiver;
|
||||
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
|
||||
import org.apache.rocketmq.spring.core.RocketMQListener;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* rocketMQ消息接收器:仅在vender=rocketMQ时 && 项目实现IMQReceiver接口时 进行实例化
|
||||
* 业务: 支付订单商户通知
|
||||
*
|
||||
* @author terrfly
|
||||
* @date 2021/7/22 17:06
|
||||
*/
|
||||
@Component
|
||||
@ConditionalOnProperty(name = MQVenderCS.YML_VENDER_KEY, havingValue = MQVenderCS.ROCKET_MQ)
|
||||
@ConditionalOnBean(PayOrderMchNotifyMQ.IMQReceiver.class)
|
||||
@RocketMQMessageListener(topic = PayOrderMchNotifyMQ.MQ_NAME, consumerGroup = PayOrderMchNotifyMQ.MQ_NAME)
|
||||
public class PayOrderMchNotifyRocketMQReceiver implements IMQMsgReceiver, RocketMQListener<String> {
|
||||
|
||||
@Autowired
|
||||
private PayOrderMchNotifyMQ.IMQReceiver mqReceiver;
|
||||
|
||||
/** 接收 【 queue 】 类型的消息 **/
|
||||
@Override
|
||||
public void receiveMsg(String msg){
|
||||
mqReceiver.receive(PayOrderMchNotifyMQ.parse(msg));
|
||||
}
|
||||
|
||||
@Override
|
||||
@Async(MqThreadExecutor.EXECUTOR_PAY_ORDER_MCH_NOTIFY)
|
||||
public void onMessage(String message) {
|
||||
this.receiveMsg(message);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
package com.jeequan.jeepay.components.mq.vender.rocketmq.receive;
|
||||
|
||||
import com.jeequan.jeepay.components.mq.constant.MQVenderCS;
|
||||
import com.jeequan.jeepay.components.mq.executor.MqThreadExecutor;
|
||||
import com.jeequan.jeepay.components.mq.model.PayOrderReissueMQ;
|
||||
import com.jeequan.jeepay.components.mq.vender.IMQMsgReceiver;
|
||||
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
|
||||
import org.apache.rocketmq.spring.core.RocketMQListener;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* rocketMQ消息接收器:仅在vender=rocketMQ时 && 项目实现IMQReceiver接口时 进行实例化
|
||||
* 业务: 支付订单补单(一般用于没有回调的接口,比如微信的条码支付)
|
||||
*
|
||||
* @author terrfly
|
||||
* @date 2021/7/22 17:06
|
||||
*/
|
||||
@Component
|
||||
@ConditionalOnProperty(name = MQVenderCS.YML_VENDER_KEY, havingValue = MQVenderCS.ROCKET_MQ)
|
||||
@ConditionalOnBean(PayOrderReissueMQ.IMQReceiver.class)
|
||||
@RocketMQMessageListener(topic = PayOrderReissueMQ.MQ_NAME, consumerGroup = PayOrderReissueMQ.MQ_NAME)
|
||||
public class PayOrderReissueRocketMQReceiver implements IMQMsgReceiver, RocketMQListener<String> {
|
||||
|
||||
@Autowired
|
||||
private PayOrderReissueMQ.IMQReceiver mqReceiver;
|
||||
|
||||
/** 接收 【 queue 】 类型的消息 **/
|
||||
@Override
|
||||
public void receiveMsg(String msg){
|
||||
mqReceiver.receive(PayOrderReissueMQ.parse(msg));
|
||||
}
|
||||
|
||||
@Override
|
||||
@Async(MqThreadExecutor.EXECUTOR_PAY_ORDER_REISSUE)
|
||||
public void onMessage(String message) {
|
||||
this.receiveMsg(message);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package com.jeequan.jeepay.components.mq.vender.rocketmq.receive;
|
||||
|
||||
import com.jeequan.jeepay.components.mq.constant.MQVenderCS;
|
||||
import com.jeequan.jeepay.components.mq.executor.MqThreadExecutor;
|
||||
import com.jeequan.jeepay.components.mq.model.PushPrinterMQ;
|
||||
import com.jeequan.jeepay.components.mq.vender.IMQMsgReceiver;
|
||||
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
|
||||
import org.apache.rocketmq.spring.core.RocketMQListener;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* rocketMQ消息接收器:仅在vender=rocketMQ时 && 项目实现IMQReceiver接口时 进行实例化
|
||||
* 业务: 云打印推送
|
||||
*
|
||||
* @author terrfly
|
||||
* @date 2021/7/22 17:06
|
||||
*/
|
||||
@Component
|
||||
@ConditionalOnProperty(name = MQVenderCS.YML_VENDER_KEY, havingValue = MQVenderCS.ROCKET_MQ)
|
||||
@ConditionalOnBean(PushPrinterMQ.IMQReceiver.class)
|
||||
@RocketMQMessageListener(topic = PushPrinterMQ.MQ_NAME, consumerGroup = PushPrinterMQ.MQ_NAME)
|
||||
public class PushPrinterRocketMQReceiver implements IMQMsgReceiver, RocketMQListener<String> {
|
||||
|
||||
@Autowired
|
||||
private PushPrinterMQ.IMQReceiver mqReceiver;
|
||||
|
||||
/** 接收 【 queue 】 类型的消息 **/
|
||||
@Override
|
||||
public void receiveMsg(String msg){
|
||||
mqReceiver.receive(PushPrinterMQ.parse(msg));
|
||||
}
|
||||
|
||||
@Override
|
||||
@Async(MqThreadExecutor.EXECUTOR_PUSH_PRINTER)
|
||||
public void onMessage(String msg) {
|
||||
this.receiveMsg(msg);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package com.jeequan.jeepay.components.mq.vender.rocketmq.receive;
|
||||
|
||||
import com.jeequan.jeepay.components.mq.constant.MQVenderCS;
|
||||
import com.jeequan.jeepay.components.mq.executor.MqThreadExecutor;
|
||||
import com.jeequan.jeepay.components.mq.model.PushSpeakerMQ;
|
||||
import com.jeequan.jeepay.components.mq.vender.IMQMsgReceiver;
|
||||
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
|
||||
import org.apache.rocketmq.spring.core.RocketMQListener;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* rocketMQ消息接收器:仅在vender=rocketMQ时 && 项目实现IMQReceiver接口时 进行实例化
|
||||
* 业务: 云喇叭推送
|
||||
*
|
||||
* @author terrfly
|
||||
* @date 2021/7/22 17:06
|
||||
*/
|
||||
@Component
|
||||
@ConditionalOnProperty(name = MQVenderCS.YML_VENDER_KEY, havingValue = MQVenderCS.ROCKET_MQ)
|
||||
@ConditionalOnBean(PushSpeakerMQ.IMQReceiver.class)
|
||||
@RocketMQMessageListener(topic = PushSpeakerMQ.MQ_NAME, consumerGroup = PushSpeakerMQ.MQ_NAME)
|
||||
public class PushSpeakerRocketMQReceiver implements IMQMsgReceiver, RocketMQListener<String> {
|
||||
|
||||
@Autowired
|
||||
private PushSpeakerMQ.IMQReceiver mqReceiver;
|
||||
|
||||
/** 接收 【 queue 】 类型的消息 **/
|
||||
@Override
|
||||
public void receiveMsg(String msg){
|
||||
mqReceiver.receive(PushSpeakerMQ.parse(msg));
|
||||
}
|
||||
|
||||
@Override
|
||||
@Async(MqThreadExecutor.EXECUTOR_PUSH_SPEAKER)
|
||||
public void onMessage(String msg) {
|
||||
this.receiveMsg(msg);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package com.jeequan.jeepay.components.mq.vender.rocketmq.receive;
|
||||
|
||||
import com.jeequan.jeepay.components.mq.constant.MQVenderCS;
|
||||
import com.jeequan.jeepay.components.mq.executor.MqThreadExecutor;
|
||||
import com.jeequan.jeepay.components.mq.model.PushWxMpMsgMQ;
|
||||
import com.jeequan.jeepay.components.mq.vender.IMQMsgReceiver;
|
||||
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
|
||||
import org.apache.rocketmq.spring.core.RocketMQListener;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* rocketMQ消息接收器:仅在vender=rocketMQ时 && 项目实现IMQReceiver接口时 进行实例化
|
||||
* 业务: 微信公众号通知
|
||||
*
|
||||
* @author terrfly
|
||||
* @date 2021/7/22 17:06
|
||||
*/
|
||||
@Component
|
||||
@ConditionalOnProperty(name = MQVenderCS.YML_VENDER_KEY, havingValue = MQVenderCS.ROCKET_MQ)
|
||||
@ConditionalOnBean(PushWxMpMsgMQ.IMQReceiver.class)
|
||||
@RocketMQMessageListener(topic = PushWxMpMsgMQ.MQ_NAME, consumerGroup = PushWxMpMsgMQ.MQ_NAME)
|
||||
public class PushWxMpMsgRocketMQReceiver implements IMQMsgReceiver, RocketMQListener<String> {
|
||||
|
||||
@Autowired
|
||||
private PushWxMpMsgMQ.IMQReceiver mqReceiver;
|
||||
|
||||
/** 接收 【 queue 】 类型的消息 **/
|
||||
@Override
|
||||
public void receiveMsg(String msg){
|
||||
mqReceiver.receive(PushWxMpMsgMQ.parse(msg));
|
||||
}
|
||||
|
||||
@Override
|
||||
@Async(MqThreadExecutor.EXECUTOR_PUSH_MP_MSG)
|
||||
public void onMessage(String msg) {
|
||||
this.receiveMsg(msg);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
package com.jeequan.jeepay.components.mq.vender.rocketmq.receive;
|
||||
|
||||
import com.jeequan.jeepay.components.mq.constant.MQVenderCS;
|
||||
import com.jeequan.jeepay.components.mq.model.ResetAppConfigMQ;
|
||||
import com.jeequan.jeepay.components.mq.vender.IMQMsgReceiver;
|
||||
import org.apache.rocketmq.spring.annotation.MessageModel;
|
||||
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
|
||||
import org.apache.rocketmq.spring.core.RocketMQListener;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* rocketMQ消息接收器:仅在vender=rocketMQ时 && 项目实现IMQReceiver接口时 进行实例化
|
||||
* 业务: 更新系统配置参数
|
||||
*
|
||||
* @author terrfly
|
||||
* @date 2021/7/22 17:06
|
||||
*/
|
||||
@Component
|
||||
@ConditionalOnProperty(name = MQVenderCS.YML_VENDER_KEY, havingValue = MQVenderCS.ROCKET_MQ)
|
||||
@ConditionalOnBean(ResetAppConfigMQ.IMQReceiver.class)
|
||||
@RocketMQMessageListener(topic = ResetAppConfigMQ.MQ_NAME, consumerGroup = ResetAppConfigMQ.MQ_NAME, messageModel = MessageModel.BROADCASTING)
|
||||
public class ResetAppConfigRocketMQReceiver implements IMQMsgReceiver, RocketMQListener<String> {
|
||||
|
||||
@Autowired
|
||||
private ResetAppConfigMQ.IMQReceiver mqReceiver;
|
||||
|
||||
/**
|
||||
* 接收 【 MQSendTypeEnum.BROADCAST 】 广播类型的消息
|
||||
**/
|
||||
@Override
|
||||
public void receiveMsg(String msg) {
|
||||
mqReceiver.receive(ResetAppConfigMQ.parse(msg));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMessage(String message) {
|
||||
this.receiveMsg(message);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
package com.jeequan.jeepay.components.mq.vender.rocketmq.receive;
|
||||
|
||||
import com.jeequan.jeepay.components.mq.constant.MQVenderCS;
|
||||
import com.jeequan.jeepay.components.mq.model.ResetIsvMchAppInfoConfigMQ;
|
||||
import com.jeequan.jeepay.components.mq.vender.IMQMsgReceiver;
|
||||
import org.apache.rocketmq.spring.annotation.MessageModel;
|
||||
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
|
||||
import org.apache.rocketmq.spring.core.RocketMQListener;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* rocketMQ消息接收器:仅在vender=rocketMQ时 && 项目实现IMQReceiver接口时 进行实例化
|
||||
* 业务: 更新服务商/商户/商户应用配置信息
|
||||
*
|
||||
* @author terrfly
|
||||
* @date 2021/7/22 17:06
|
||||
*/
|
||||
@Component
|
||||
@ConditionalOnProperty(name = MQVenderCS.YML_VENDER_KEY, havingValue = MQVenderCS.ROCKET_MQ)
|
||||
@ConditionalOnBean(ResetIsvMchAppInfoConfigMQ.IMQReceiver.class)
|
||||
@RocketMQMessageListener(topic = ResetIsvMchAppInfoConfigMQ.MQ_NAME, consumerGroup = ResetIsvMchAppInfoConfigMQ.MQ_NAME, messageModel = MessageModel.BROADCASTING)
|
||||
public class ResetIsvMchAppInfoRocketMQReceiver implements IMQMsgReceiver, RocketMQListener<String> {
|
||||
|
||||
@Autowired
|
||||
private ResetIsvMchAppInfoConfigMQ.IMQReceiver mqReceiver;
|
||||
|
||||
/**
|
||||
* 接收 【 MQSendTypeEnum.BROADCAST 】 广播类型的消息
|
||||
**/
|
||||
@Override
|
||||
public void receiveMsg(String msg) {
|
||||
mqReceiver.receive(ResetIsvMchAppInfoConfigMQ.parse(msg));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMessage(String message) {
|
||||
this.receiveMsg(message);
|
||||
}
|
||||
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user