*/
protected void doSend(boolean inOut, String destinationName, Destination destination,
MessageCreator messageCreator, DeferredMessageSentCallback callback) {
CamelJmsTemplate template = null;
CamelJmsTemplate102 template102 = null;
if (endpoint.isUseVersion102()) {
template102 = (JmsConfiguration.CamelJmsTemplate102) (inOut ? getInOutTemplate() : getInOnlyTemplate());
} else {
template = (CamelJmsTemplate) (inOut ? getInOutTemplate() : getInOnlyTemplate());
}
if (LOG.isTraceEnabled()) {
LOG.trace("Using " + (inOut ? "inOut" : "inOnly") + " jms template to send with API "
+ (endpoint.isUseVersion102() ? "v1.0.2" : "v1.1"));
}
// destination should be preferred
if (destination != null) {
if (inOut) {
if (template != null) {
template.send(destination, messageCreator, callback);
} else if (template102 != null) {
template102.send(destination, messageCreator, callback);
}
} else {
if (template != null) {
template.send(destination, messageCreator);
} else if (template102 != null) {
template102.send(destination, messageCreator);
}
}
} else if (destinationName != null) {
if (inOut) {
if (template != null) {
template.send(destinationName, messageCreator, callback);
} else if (template102 != null) {
template102.send(destinationName, messageCreator, callback);
}
} else {
if (template != null) {
template.send(destinationName, messageCreator);
} else if (template102 != null) {
template102.send(destinationName, messageCreator);
}
}
} else {
throw new IllegalArgumentException("Neither destination nor destinationName is specified on this endpoint: " + endpoint);
}