Commit 7d35fcd5 authored by yanzg's avatar yanzg

升级新版本

parent 60d61cb7
......@@ -66,7 +66,19 @@ public interface MqService {
/**
* 消息收到确认
* 消息收到确认,出错时不需要重发
*
* @param messageBody 消息体
* @param channel  收到的通道
* @param message  消息内容
* @param consumerMessage 消费者,具体业务处理函数
*/
@ApiOperation(value = "消息收到确认")
void basicHandle(Message messageBody, Channel channel, String message, Consumer<String> consumerMessage);
/**
* 消息收到确认,出错时重发
*
* @param messageBody 消息体
* @param channel  收到的通道
......@@ -79,7 +91,7 @@ public interface MqService {
/**
* 消息收到确认
* 消息收到确认,出错时重发
*
* @param messageBody 消息体
* @param channel  收到的通道
......@@ -92,7 +104,7 @@ public interface MqService {
void basicHandle(Message messageBody, Channel channel, String exchangeNameAndRouteKey, String message, long dedTime, Consumer<String> consumerMessage);
/**
* 消息收到确认
* 消息收到确认,出错时重发
*
* @param messageBody 消息体
* @param channel  收到的通道
......
......@@ -105,6 +105,11 @@ public class MqServiceImpl implements MqService {
messageSendService.basicAck(message, channel);
}
@Override
public void basicHandle(Message messageBody, Channel channel, String message, Consumer<String> consumerMessage) {
this.basicHandle(messageBody, channel, StringHelper.EMPTY, StringHelper.EMPTY, message, 0, consumerMessage);
}
@Override
public void basicHandle(Message messageBody, Channel channel, String exchangeNameAndRouteKey, String message, Consumer<String> consumerMessage) {
this.basicHandle(messageBody, channel, exchangeNameAndRouteKey, exchangeNameAndRouteKey, message, 60 * 1000, consumerMessage);
......@@ -123,6 +128,9 @@ public class MqServiceImpl implements MqService {
Log.error(MqServiceImpl.class, e);
} catch (Exception e) {
Log.error(MqServiceImpl.class, e);
if (StringHelper.isEmpty(exchangeName, routeKey)) {
return;
}
this.message(new MessageVo(exchangeName, routeKey, message, dedTime));
} finally {
this.basicAck(messageBody, channel);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment