use of com.sun.messaging.jmq.jmsserver.data.handlers.admin.ReplaceMessageHandler in project openmq by eclipse-ee4j.
the class MessageManagerConfig method replaceMessage.
public String replaceMessage(String destinationType, String destinationName, String messageID, HashMap messageBody) throws MBeanException {
String newMsgID = null;
try {
if (destinationType == null) {
throw new BrokerException("Admin replaceMessage: destination name and type not specified", Status.BAD_REQUEST);
}
PacketRouter pr = Globals.getPacketRouter(1);
if (pr == null) {
throw new BrokerException("Admin deleteMessage: Could not locate Admin Packet Router");
}
AdminDataHandler dhd = (AdminDataHandler) pr.getHandler(PacketType.OBJECT_MESSAGE);
ReplaceMessageHandler hd = (ReplaceMessageHandler) dhd.getHandler(com.sun.messaging.jmq.util.admin.MessageType.REPLACE_MESSAGE);
newMsgID = hd.replaceMessage(messageID, destinationName, messageBody, destinationType.equals(DestinationType.QUEUE));
} catch (Exception e) {
boolean logstack = true;
if (e instanceof BrokerException) {
int status = ((BrokerException) e).getStatusCode();
if (status == Status.NOT_ALLOWED || status == Status.NOT_FOUND || status == Status.CONFLICT || status == Status.BAD_REQUEST) {
logstack = false;
}
}
Object[] args = { messageID, destinationName, e.getMessage() };
String emsg = rb.getKString(rb.X_ADMIN_DELETE_MSG, args);
if (logstack) {
logger.logStack(Logger.ERROR, emsg, e);
} else {
logger.log(Logger.ERROR, emsg, e);
}
handleOperationException("replaceMessage", e);
}
return (newMsgID);
}
Aggregations