* @param callback optional callback to invoke when message has been sent
*/
protected void doSend(boolean inOut, String destinationName, Destination destination,
MessageCreator messageCreator, MessageSentCallback callback) {
CamelJmsTemplate template = (CamelJmsTemplate) (inOut ? getInOutTemplate() : getInOnlyTemplate());
if (LOG.isTraceEnabled()) {
LOG.trace("Using {} jms template", inOut ? "inOut" : "inOnly");
}
// destination should be preferred
if (destination != null) {
if (inOut) {
if (template != null) {
template.send(destination, messageCreator, callback);
}
} else {
if (template != null) {
template.send(destination, messageCreator, callback);
}
}
} else if (destinationName != null) {
if (inOut) {
if (template != null) {
template.send(destinationName, messageCreator, callback);
}
} else {
if (template != null) {
template.send(destinationName, messageCreator, callback);
}
}
} else {
throw new IllegalArgumentException("Neither destination nor destinationName is specified on this endpoint: " + endpoint);
}