Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
O
order-group
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
order-group-application
order-group
Commits
6bc5c8ba
Commit
6bc5c8ba
authored
Aug 25, 2022
by
周晓航
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新增保存发送消息体 用于补偿发送使用
parent
e4bd032b
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
2 deletions
+26
-2
call-back-service/src/main/java/cn/freemud/amp/service/MyCorrelationData.java
+16
-0
call-back-service/src/main/java/cn/freemud/amp/service/SendMQConfirmCallback.java
+10
-2
No files found.
call-back-service/src/main/java/cn/freemud/amp/service/MyCorrelationData.java
0 → 100644
View file @
6bc5c8ba
package
cn
.
freemud
.
amp
.
service
;
import
lombok.Data
;
import
org.springframework.amqp.rabbit.connection.CorrelationData
;
/**
* @author : xh.Z
* @email : fisherman0510@163.com
* @Date : 2022/8/25 11:00
* @description :
*/
@Data
public
class
MyCorrelationData
extends
CorrelationData
{
private
String
myContent
;
}
call-back-service/src/main/java/cn/freemud/amp/service/SendMQConfirmCallback.java
View file @
6bc5c8ba
package
cn
.
freemud
.
amp
.
service
;
package
cn
.
freemud
.
amp
.
service
;
import
cn.freemud.amqp.FastJsonMessageConverter
;
import
cn.freemud.amqp.FastJsonMessageConverter
;
import
cn.freemud.amqp.MQMessage
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.TypeReference
;
import
com.freemud.application.sdk.api.ordercenter.entities.vo.OrderCallBackRequestVo
;
import
lombok.extern.log4j.Log4j2
;
import
lombok.extern.log4j.Log4j2
;
import
org.springframework.amqp.core.Message
;
import
org.springframework.amqp.core.Message
;
import
org.springframework.amqp.rabbit.connection.ConnectionFactory
;
import
org.springframework.amqp.rabbit.connection.ConnectionFactory
;
...
@@ -40,8 +43,9 @@ public class SendMQConfirmCallback {
...
@@ -40,8 +43,9 @@ public class SendMQConfirmCallback {
public
void
convertAndSend
(
String
exchange
,
String
queueName
,
final
Object
object
)
{
public
void
convertAndSend
(
String
exchange
,
String
queueName
,
final
Object
object
)
{
CorrelationData
data
=
new
CorrelationData
();
MyCorrelationData
data
=
new
MyCorrelationData
();
data
.
setId
(
JSON
.
toJSONString
(
data
));
data
.
setId
(
System
.
currentTimeMillis
()
+
""
);
data
.
setMyContent
(
JSON
.
toJSONString
(
object
));
this
.
rabbitTemplate
.
convertAndSend
(
exchange
,
queueName
,
object
,
data
);
this
.
rabbitTemplate
.
convertAndSend
(
exchange
,
queueName
,
object
,
data
);
}
}
...
@@ -65,6 +69,10 @@ public class SendMQConfirmCallback {
...
@@ -65,6 +69,10 @@ public class SendMQConfirmCallback {
*/
*/
@Override
@Override
public
void
confirm
(
CorrelationData
correlationData
,
boolean
ack
,
String
cause
)
{
public
void
confirm
(
CorrelationData
correlationData
,
boolean
ack
,
String
cause
)
{
String
id
=
correlationData
.
getId
();
MyCorrelationData
data
=
(
MyCorrelationData
)
correlationData
;
MQMessage
<
OrderCallBackRequestVo
>
orderCallBackRequestVoMQMessage
=
JSON
.
parseObject
(
data
.
getMyContent
(),
new
TypeReference
<
MQMessage
<
OrderCallBackRequestVo
>>()
{
});
log
.
info
(
"消息ID:{},消息是否到达Broker:{},失败信息:{}"
,
correlationData
,
ack
,
cause
);
log
.
info
(
"消息ID:{},消息是否到达Broker:{},失败信息:{}"
,
correlationData
,
ack
,
cause
);
}
}
});
});
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment