-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[update] 帖子发布,不使用redis作为失败反馈,直接使用kafka
- Loading branch information
Showing
116 changed files
with
403 additions
and
1,861 deletions.
There are no files selected for viewing
24 changes: 0 additions & 24 deletions
24
petplanet-common/src/main/java/top/zynorl/petplanet/common/enums/TransactionStatusEnum.java
This file was deleted.
Oops, something went wrong.
20 changes: 20 additions & 0 deletions
20
...ommon/src/main/java/top/zynorl/petplanet/common/exception/RepeatConsumptionException.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,20 @@ | ||
package top.zynorl.petplanet.common.exception; | ||
|
||
import lombok.Data; | ||
import lombok.EqualsAndHashCode; | ||
|
||
/** | ||
* Created by zynorl on 2024/1/18 15:25 | ||
*/ | ||
@EqualsAndHashCode(callSuper = true) | ||
@Data | ||
public class RepeatConsumptionException extends RuntimeException{ | ||
private static final long serialVersionUID = 1L; | ||
private String transactionId; | ||
|
||
public RepeatConsumptionException(String message, String transactionId) { | ||
super(message); | ||
this.transactionId = transactionId; | ||
} | ||
|
||
} |
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
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
23 changes: 23 additions & 0 deletions
23
...anet-post/src/main/java/top/zynorl/petplanet/post/common/pojo/dto/BaseTransactionDTO.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,23 @@ | ||
package top.zynorl.petplanet.post.common.pojo.dto; | ||
|
||
import lombok.Builder; | ||
import lombok.Data; | ||
|
||
import java.io.Serializable; | ||
|
||
/** | ||
* Created by zynorl on 2024/1/17 10:20 | ||
*/ | ||
@Data | ||
public class BaseTransactionDTO implements Serializable { | ||
private static final long serialVersionUID = 1L; | ||
/** | ||
* 事务id | ||
*/ | ||
private String transactionId; | ||
|
||
/** | ||
* kafka主题 | ||
*/ | ||
private String topic; | ||
} |
50 changes: 0 additions & 50 deletions
50
petplanet-post/src/main/java/top/zynorl/petplanet/post/common/pojo/dto/PostDTO.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
35 changes: 35 additions & 0 deletions
35
...st/src/main/java/top/zynorl/petplanet/post/common/pojo/dto/PublishPostTransactionDTO.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,35 @@ | ||
package top.zynorl.petplanet.post.common.pojo.dto; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
|
||
import java.io.Serializable; | ||
|
||
/** | ||
* @version 1.0 | ||
* @Author niuzy | ||
* @Date 2024/01/10 | ||
**/ | ||
@Data | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
public class PublishPostTransactionDTO extends BaseTransactionDTO implements Serializable { | ||
private static final long serialVersionUID = 1L; | ||
|
||
/** | ||
* 关联用户id | ||
*/ | ||
private Long userId; | ||
|
||
/** | ||
* 帖子id | ||
*/ | ||
private String postId; | ||
|
||
/** | ||
* 地点Id | ||
*/ | ||
private Long locationId; | ||
} |
28 changes: 28 additions & 0 deletions
28
...t/src/main/java/top/zynorl/petplanet/post/listener/TransactionFailedCallbackListener.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,28 @@ | ||
package top.zynorl.petplanet.post.listener; | ||
|
||
import cn.hutool.json.JSONUtil; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.kafka.annotation.KafkaListener; | ||
import org.springframework.stereotype.Component; | ||
import top.zynorl.petplanet.post.common.pojo.dto.PublishPostFailedCallbackDTO; | ||
import top.zynorl.petplanet.post.transaction.PostPublishTransactionalService; | ||
|
||
/** | ||
* @version 1.0 | ||
* @Author niuzy | ||
* @Date 2024/01/05 | ||
**/ | ||
@Component | ||
@Slf4j | ||
public class TransactionFailedCallbackListener { | ||
private static final String postPublishTopic = "post_publish"; | ||
@Autowired | ||
private PostPublishTransactionalService postPublishTransactionalService; | ||
|
||
@KafkaListener(topics = postPublishTopic) | ||
public void postPublishListener(String message) { | ||
PublishPostFailedCallbackDTO publishPostFailedCallbackDTO = JSONUtil.toBean(message, PublishPostFailedCallbackDTO.class); | ||
postPublishTransactionalService.DoCancel(publishPostFailedCallbackDTO); | ||
} | ||
} |
77 changes: 0 additions & 77 deletions
77
...post/src/main/java/top/zynorl/petplanet/post/scheduler/KafkaTransactionSchedulerTask.java
This file was deleted.
Oops, something went wrong.
44 changes: 0 additions & 44 deletions
44
...-post/src/main/java/top/zynorl/petplanet/post/serializer/TransactionRecordSerializer.java
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.