forked from lilishop/lilishop
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
49603e2
commit 96697e1
Showing
9 changed files
with
90 additions
and
143 deletions.
There are no files selected for viewing
32 changes: 32 additions & 0 deletions
32
framework/src/main/java/cn/lili/common/event/TransactionCommitSendMQEvent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package cn.lili.common.event; | ||
|
||
import lombok.Getter; | ||
import org.springframework.context.ApplicationEvent; | ||
|
||
/** | ||
* 事务提交后发生mq事件 | ||
* | ||
* @author paulG | ||
* @since 2022/1/19 | ||
**/ | ||
public class TransactionCommitSendMQEvent extends ApplicationEvent { | ||
|
||
private static final long serialVersionUID = 5885956821347953071L; | ||
|
||
|
||
@Getter | ||
private final String topic; | ||
|
||
@Getter | ||
private final String tag; | ||
|
||
@Getter | ||
private final String message; | ||
|
||
public TransactionCommitSendMQEvent(Object source, String topic, String tag, String message) { | ||
super(source); | ||
this.topic = topic; | ||
this.tag = tag; | ||
this.message = message; | ||
} | ||
} |
38 changes: 38 additions & 0 deletions
38
framework/src/main/java/cn/lili/common/listener/TransactionCommitSendMQListener.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package cn.lili.common.listener; | ||
|
||
import cn.lili.common.event.TransactionCommitSendMQEvent; | ||
import cn.lili.rocketmq.RocketmqSendCallbackBuilder; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.apache.rocketmq.spring.core.RocketMQTemplate; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.stereotype.Component; | ||
import org.springframework.transaction.event.TransactionPhase; | ||
import org.springframework.transaction.event.TransactionalEventListener; | ||
|
||
/** | ||
* 事务提交监听器 | ||
* | ||
* @author paulG | ||
* @since 2022/1/19 | ||
**/ | ||
@Component | ||
@Slf4j | ||
public class TransactionCommitSendMQListener { | ||
|
||
/** | ||
* rocketMq | ||
*/ | ||
@Autowired | ||
private RocketMQTemplate rocketMQTemplate; | ||
|
||
|
||
@TransactionalEventListener(phase = TransactionPhase.AFTER_COMMIT) | ||
public void send(TransactionCommitSendMQEvent event) { | ||
log.info("事务提交,发送mq信息!{}", event); | ||
String destination = event.getTopic() + ":" + event.getTag(); | ||
//发送订单变更mq消息 | ||
rocketMQTemplate.asyncSend(destination, event.getMessage(), RocketmqSendCallbackBuilder.commonCallback()); | ||
} | ||
|
||
|
||
} |
24 changes: 0 additions & 24 deletions
24
framework/src/main/java/cn/lili/modules/goods/event/GeneratorEsGoodsIndexEvent.java
This file was deleted.
Oops, something went wrong.
37 changes: 0 additions & 37 deletions
37
framework/src/main/java/cn/lili/modules/goods/listener/GeneratorEsGoodsIndexListener.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 0 additions & 19 deletions
19
...work/src/main/java/cn/lili/modules/promotion/event/UpdateEsGoodsIndexPromotionsEvent.java
This file was deleted.
Oops, something went wrong.
41 changes: 0 additions & 41 deletions
41
...rc/main/java/cn/lili/modules/promotion/listener/UpdateEsGoodsIndexPromotionsListener.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters