// Create the new destination and store it
Session session;
try {
session = connection.createSession(fTransacted, ackMode);
} catch (JMSException e) {
throw new MessagingException(e.getMessage(), e);
}
// Look up the destination otherwise create it
Destination destination = null;
try {
destination = (Destination) jndiLookup(name);
} catch (MessagingException me) {
logger.debug("JNDI lookup for destination " + name + " failed. "
+ "Destination must be created.");
destination = null;
}
if (destination == null) {
// Create a topic or queue as specified
try {
if (type.equals(DestinationType.Queue)) {
logger.debug("setupDestination() - creating Queue" + name);
destination = session.createQueue(name);
} else {
logger.debug("setupDestination() - creating Topic " + name);
destination = session.createTopic(name);
}
} catch (JMSException e) {
throw new MessagingException(e.getMessage(), e);
}
}
jmsDest = new JMSDestination(destination, session, null, null);