|
@@ -47,7 +47,7 @@ public class ProducerServerImpl implements ProducerServer {
|
|
SendResult sendResult = rocketMQTemplate.syncSend(mqDto.getTopic() + ":" + mqDto.getTag(), mqDto);
|
|
SendResult sendResult = rocketMQTemplate.syncSend(mqDto.getTopic() + ":" + mqDto.getTag(), mqDto);
|
|
// 同步消息发送成功会有一个返回值,我们可以用这个返回值进行判断和获取一些信息
|
|
// 同步消息发送成功会有一个返回值,我们可以用这个返回值进行判断和获取一些信息
|
|
log.info("sendResult:{}", JacksonUtil.parseJson(sendResult));
|
|
log.info("sendResult:{}", JacksonUtil.parseJson(sendResult));
|
|
- return ResultUtil.ok(Collections.singletonMap("success", true));
|
|
|
|
|
|
+ return ResultUtil.ok(Collections.singletonMap(SystemConstant.SUCCESS, true));
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -62,7 +62,7 @@ public class ProducerServerImpl implements ProducerServer {
|
|
SendResult sendResult = rocketMQTemplate.syncSendOrderly(mqDto.getTopic() + ":" + mqDto.getTag(), mqDto, mqDto.getObjId());
|
|
SendResult sendResult = rocketMQTemplate.syncSendOrderly(mqDto.getTopic() + ":" + mqDto.getTag(), mqDto, mqDto.getObjId());
|
|
// 同步顺序消息发送成功会有一个返回值,我们可以用这个返回值进行判断和获取一些信息
|
|
// 同步顺序消息发送成功会有一个返回值,我们可以用这个返回值进行判断和获取一些信息
|
|
log.info("sendResult:{}", JacksonUtil.parseJson(sendResult));
|
|
log.info("sendResult:{}", JacksonUtil.parseJson(sendResult));
|
|
- return ResultUtil.ok(Collections.singletonMap("success", true));
|
|
|
|
|
|
+ return ResultUtil.ok(Collections.singletonMap(SystemConstant.SUCCESS, true));
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -77,7 +77,7 @@ public class ProducerServerImpl implements ProducerServer {
|
|
// Message message = assembleMessage(mqDto);
|
|
// Message message = assembleMessage(mqDto);
|
|
org.springframework.messaging.Message messageTran = MessageBuilder.withPayload(mqDto).build();
|
|
org.springframework.messaging.Message messageTran = MessageBuilder.withPayload(mqDto).build();
|
|
rocketMQTemplate.syncSend(mqDto.getTopic() + ":" + mqDto.getTag(), messageTran, SystemConstant.MESSAGE_TIMEOUT, Integer.parseInt(String.valueOf(mqDto.getProperties().get("timeOut"))));
|
|
rocketMQTemplate.syncSend(mqDto.getTopic() + ":" + mqDto.getTag(), messageTran, SystemConstant.MESSAGE_TIMEOUT, Integer.parseInt(String.valueOf(mqDto.getProperties().get("timeOut"))));
|
|
- return ResultUtil.ok(Collections.singletonMap("success", true));
|
|
|
|
|
|
+ return ResultUtil.ok(Collections.singletonMap(SystemConstant.SUCCESS, true));
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -102,7 +102,7 @@ public class ProducerServerImpl implements ProducerServer {
|
|
throw new BusinessException(throwable.getMessage());
|
|
throw new BusinessException(throwable.getMessage());
|
|
}
|
|
}
|
|
});
|
|
});
|
|
- return ResultUtil.ok(Collections.singletonMap("success", true));
|
|
|
|
|
|
+ return ResultUtil.ok(Collections.singletonMap(SystemConstant.SUCCESS, true));
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -127,7 +127,7 @@ public class ProducerServerImpl implements ProducerServer {
|
|
throw new BusinessException(throwable.getMessage());
|
|
throw new BusinessException(throwable.getMessage());
|
|
}
|
|
}
|
|
});
|
|
});
|
|
- return ResultUtil.ok(Collections.singletonMap("success", true));
|
|
|
|
|
|
+ return ResultUtil.ok(Collections.singletonMap(SystemConstant.SUCCESS, true));
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -154,7 +154,7 @@ public class ProducerServerImpl implements ProducerServer {
|
|
throw new BusinessException(throwable.getMessage());
|
|
throw new BusinessException(throwable.getMessage());
|
|
}
|
|
}
|
|
}, SystemConstant.MESSAGE_TIMEOUT, Integer.parseInt(String.valueOf(mqDto.getProperties().get("timeOut"))));
|
|
}, SystemConstant.MESSAGE_TIMEOUT, Integer.parseInt(String.valueOf(mqDto.getProperties().get("timeOut"))));
|
|
- return ResultUtil.ok(Collections.singletonMap("success", true));
|
|
|
|
|
|
+ return ResultUtil.ok(Collections.singletonMap(SystemConstant.SUCCESS, true));
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -167,7 +167,7 @@ public class ProducerServerImpl implements ProducerServer {
|
|
public Result sendOneWay(MqDto mqDto) {
|
|
public Result sendOneWay(MqDto mqDto) {
|
|
log.info("sendOneWay mqDto:{}", JacksonUtil.parseJson(mqDto));
|
|
log.info("sendOneWay mqDto:{}", JacksonUtil.parseJson(mqDto));
|
|
rocketMQTemplate.sendOneWay(mqDto.getTopic() + ":" + mqDto.getTag(), mqDto);
|
|
rocketMQTemplate.sendOneWay(mqDto.getTopic() + ":" + mqDto.getTag(), mqDto);
|
|
- return ResultUtil.ok(Collections.singletonMap("success", true));
|
|
|
|
|
|
+ return ResultUtil.ok(Collections.singletonMap(SystemConstant.SUCCESS, true));
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -180,7 +180,7 @@ public class ProducerServerImpl implements ProducerServer {
|
|
public Result sendOneWayOrderly(MqDto mqDto) {
|
|
public Result sendOneWayOrderly(MqDto mqDto) {
|
|
log.info("sendOneWayOrderly mqDto:{}", JacksonUtil.parseJson(mqDto));
|
|
log.info("sendOneWayOrderly mqDto:{}", JacksonUtil.parseJson(mqDto));
|
|
rocketMQTemplate.sendOneWayOrderly(mqDto.getTopic() + ":" + mqDto.getTag(), mqDto, mqDto.getObjId());
|
|
rocketMQTemplate.sendOneWayOrderly(mqDto.getTopic() + ":" + mqDto.getTag(), mqDto, mqDto.getObjId());
|
|
- return ResultUtil.ok(Collections.singletonMap("success", true));
|
|
|
|
|
|
+ return ResultUtil.ok(Collections.singletonMap(SystemConstant.SUCCESS, true));
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -197,7 +197,7 @@ public class ProducerServerImpl implements ProducerServer {
|
|
//发送事务消息
|
|
//发送事务消息
|
|
TransactionSendResult transactionSendResult = rocketMQTemplate.sendMessageInTransaction(mqDto.getTopic() + ":" + mqDto.getTag(), messageTran, null);
|
|
TransactionSendResult transactionSendResult = rocketMQTemplate.sendMessageInTransaction(mqDto.getTopic() + ":" + mqDto.getTag(), messageTran, null);
|
|
log.info("transactionSendResult:{}", JacksonUtil.parseJson(transactionSendResult));
|
|
log.info("transactionSendResult:{}", JacksonUtil.parseJson(transactionSendResult));
|
|
- return ResultUtil.ok(Collections.singletonMap("success", true));
|
|
|
|
|
|
+ return ResultUtil.ok(Collections.singletonMap(SystemConstant.SUCCESS, true));
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|