}
Service noneExistingService = new Service("none-exising-category", "none-existing-service-name");
ServiceInvoker si = new ServiceInvoker(noneExistingService);
si.deliverSync(message, 1000);
} catch (MessageStoreException mse) {
throw new ActionProcessingException(mse.getMessage(), mse);
} catch (MessageDeliverException mde) {
//Adding this control code to show where the message now is.
//We should get here on and we should have a message in the DLQ.
try {
Map<URI, Message> messageMap = ms.getAllMessages(MessageStore.CLASSIFICATION_DLQ);
while (messageMap.size() == 0) { //we may have to wait for the DLQ Service to act.
logger.info("...Waiting for the DLQ Service to act.");
try {
Thread.sleep(100);
} catch (InterruptedException ie) {
logger.error(ie);
}
messageMap = ms.getAllMessages(MessageStore.CLASSIFICATION_DLQ);
}
for (URI key : messageMap.keySet()) {
dlqMessage = messageMap.get(key);
logger.info("*******************************");
logger.info("Message in the DLQ queue should be the same message: " + compare(message.getBody(), dlqMessage.getBody()));
logger.info("Message=" + message.getBody());
logger.info("dlqMessage=" + dlqMessage.getBody());
logger.info("*******************************");
}
} catch (MessageStoreException mse) {
throw new ActionProcessingException(mse.getMessage(), mse);
}
} catch (RegistryException re) {
throw new ActionProcessingException(re.getMessage(), re);
} catch (FaultMessageException fme) {
throw new ActionProcessingException(fme.getMessage(), fme);
}
return dlqMessage;
}