package com.mes.service;
|
|
|
import java.util.List;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
@Service
|
public class MqMessage {
|
@Autowired
|
private RabbitMQUtils rabbitMQUtils;
|
|
public boolean Add(String message, String queueName,String messageId){
|
try {
|
return rabbitMQUtils.sendMessageWithId(message, queueName,messageId);
|
} catch (Exception e) {
|
// TODO: handle exception
|
return false;//异常时错误
|
}
|
}
|
//根据ID查找消息
|
public String SelectId(String queueName,boolean isDelete,String messageId){
|
|
try {
|
String content=rabbitMQUtils.consumeMessageById(messageId,queueName,isDelete);
|
|
return content;
|
} catch (Exception e) {
|
// TODO: handle exception
|
return null;//异常时错误
|
}
|
}
|
public boolean Delete(String queueName,String messageId){
|
try
|
{
|
rabbitMQUtils.consumeMessageById(messageId,queueName,false);
|
return true;
|
}catch(Exception e){
|
return false;
|
}
|
|
}
|
//无修改
|
public void Update(){
|
|
}
|
|
|
}
|