Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
Y
yzg-util
Project
Project
Details
Activity
Releases
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
YZG
yzg-util
Commits
e34111a4
Commit
e34111a4
authored
May 05, 2019
by
yanzg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
消除成功接收处理
parent
f6a5d469
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
1 deletion
+22
-1
MessageService.java
.../main/java/com/yanzuoguang/mq/service/MessageService.java
+9
-0
MessageServiceImpl.java
...a/com/yanzuoguang/mq/service/impl/MessageServiceImpl.java
+13
-1
No files found.
yzg-util-mq/src/main/java/com/yanzuoguang/mq/service/MessageService.java
View file @
e34111a4
package
com
.
yanzuoguang
.
mq
.
service
;
import
com.rabbitmq.client.Channel
;
import
com.yanzuoguang.mq.vo.MessageVo
;
import
org.springframework.amqp.core.Message
;
import
java.util.List
;
...
...
@@ -48,4 +50,11 @@ public interface MessageService {
* @param messageVo
*/
String
onError
(
MessageVo
messageVo
);
/**
* 消息收到确认
* @param message
* @param channel
*/
void
basicAck
(
Message
message
,
Channel
channel
);
}
yzg-util-mq/src/main/java/com/yanzuoguang/mq/service/impl/MessageServiceImpl.java
View file @
e34111a4
package
com
.
yanzuoguang
.
mq
.
service
.
impl
;
import
com.rabbitmq.client.Channel
;
import
com.yanzuoguang.mq.base.MyRabbitTemplate
;
import
com.yanzuoguang.mq.dao.MessageDao
;
import
com.yanzuoguang.mq.service.MessageService
;
import
com.yanzuoguang.mq.vo.MessageVo
;
import
com.yanzuoguang.util.helper.DateHelper
;
import
com.yanzuoguang.util.helper.StringHelper
;
import
com.yanzuoguang.util.log.Log
;
import
org.springframework.amqp.AmqpException
;
import
org.springframework.amqp.core.Message
;
import
org.springframework.amqp.core.MessageDeliveryMode
;
...
...
@@ -16,6 +18,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.stereotype.Component
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.io.IOException
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.List
;
...
...
@@ -137,7 +140,7 @@ public class MessageServiceImpl implements MessageService {
}
else
{
MessageVo
messageTo
=
messageDao
.
load
(
messageVo
.
getMessageId
(),
MessageVo
.
class
);
isEmpty
=
messageTo
==
null
;
if
(
messageTo
!=
null
)
{
if
(
messageTo
!=
null
)
{
messageVo
=
messageTo
;
}
}
...
...
@@ -156,4 +159,13 @@ public class MessageServiceImpl implements MessageService {
return
messageVo
.
getMessageId
();
}
@Override
public
void
basicAck
(
Message
message
,
Channel
channel
)
{
try
{
channel
.
basicAck
(
message
.
getMessageProperties
().
getDeliveryTag
(),
false
);
}
catch
(
IOException
e
)
{
Log
.
error
(
MessageServiceImpl
.
class
,
e
);
}
}
}
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