use of com.sun.messaging.jmq.jmsserver.data.handlers.admin.DeleteMessageHandler in project openmq by eclipse-ee4j.
the class MessageManagerConfig method deleteMessage.
public void deleteMessage(String destinationType, String destinationName, String messageID) throws MBeanException {
try {
if (destinationType == null) {
throw new BrokerException("Admin deleteMessage: destination 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);
DeleteMessageHandler hd = (DeleteMessageHandler) dhd.getHandler(com.sun.messaging.jmq.util.admin.MessageType.DELETE_MESSAGE);
hd.deleteMessage(messageID, destinationName, 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("deleteMessage", e);
}
}
Aggregations