Commit 01f34a1a authored by yanzg's avatar yanzg

消息队列服务

parent 757cf29d
package com.yanzuoguang.mq.service;
import com.yanzuoguang.mq.vo.MessageVo;
import com.yanzuoguang.mq.vo.QueueVo;
import com.yanzuoguang.mq.vo.req.QueueQueryReqVo;
import com.yanzuoguang.util.vo.PageSizeData;
import com.yanzuoguang.util.vo.ResponseResult;
/**
* 消息队列服务
*/
public interface MqService {
/**
* 保存演示DEMO
*
* @param req
*/
ResponseResult<String> createQueue(QueueVo req);
/**
* 查询队列
*
* @param req 请求数据
* @return 查询结果
*/
ResponseResult<PageSizeData<QueueVo>> queryQueue(QueueQueryReqVo req);
/**
* 查询队列
*
* @return 查询结果
*/
ResponseResult<String> queryInit();
/**
* 发送消息
*
* @param req 需要发送的消息
* @return 消息编号,但是没有任何意义,发送成功会更改
*/
ResponseResult<String> message(MessageVo req);
/**
* 发送错误消息
*
* @param req
* @return
*/
ResponseResult<String> message_error(MessageVo req);
}
package com.yanzuoguang.mq.service.impl;
import com.yanzuoguang.mq.service.MessageService;
import com.yanzuoguang.mq.service.QueueService;
import com.yanzuoguang.mq.vo.MessageVo;
import com.yanzuoguang.mq.vo.QueueVo;
import com.yanzuoguang.mq.vo.req.QueueQueryReqVo;
import com.yanzuoguang.util.vo.PageSizeData;
import com.yanzuoguang.util.vo.ResponseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Component
public class MqServiceImpl {
@Autowired
private QueueService queueService;
@Autowired
private MessageService messageService;
/**
* 保存演示DEMO
*
* @param req
*/
public ResponseResult<String> createQueue(QueueVo req) {
req.check();
return ResponseResult.result(queueService.create(req));
}
/**
* 查询队列
*
* @param req 请求数据
* @return 查询结果
*/
public ResponseResult<PageSizeData<QueueVo>> queryQueue(QueueQueryReqVo req) {
return ResponseResult.result(queueService.query(req));
}
/**
* 查询队列
*
* @return 查询结果
*/
public ResponseResult<String> queryInit() {
queueService.init();
return ResponseResult.result("初始化完成");
}
/**
* 发送消息
*
* @param req 需要发送的消息
* @return 消息编号,但是没有任何意义,发送成功会更改
*/
public ResponseResult<String> message(MessageVo req) {
req.check();
return ResponseResult.result(messageService.send(req));
}
/**
* 发送错误消息
*
* @param req
* @return
*/
public ResponseResult<String> message_error(MessageVo req) {
req.check();
return ResponseResult.result(messageService.onError(req));
}
}
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