/** * In addition to checking if the connection factory is set, make sure that the supplied * connection factory is of the appropriate type for the specified destination type: * QueueConnectionFactory for queues, and TopicConnectionFactory for topics. */ public void afterPropertiesSet() { super.afterPropertiesSet(); // Make sure that the ConnectionFactory passed is consistent. // Some provider implementations of the ConnectionFactory interface // implement both domain interfaces under the cover, so just check if // the selected domain is consistent with the type of connection factory. if (isPubSubDomain()) { if (!(getConnectionFactory() instanceof TopicConnectionFactory)) { throw new IllegalArgumentException( "Specified a Spring JMS 1.0.2 template for topics " + "but did not supply an instance of TopicConnectionFactory"); } } else { if (!(getConnectionFactory() instanceof QueueConnectionFactory)) { throw new IllegalArgumentException( "Specified a Spring JMS 1.0.2 template for queues " + "but did not supply an instance of QueueConnectionFactory"); } } }
/** * Called to send messages to a JMS queue regarding new URLs to be crawled. * * @param submission * @throws JMSException */ public void sendMessage(UrlSubmission submission) throws JMSException { UrlMessageCreator creator = new UrlMessageCreator(submission.getJobID(), submission.getUrl(), "user submission"); template.send(destination, creator); log.info("sent submission message to crawler"); } // - sendMessage