CachingConnectionFactory connectionFactory = new CachingConnectionFactory();
connectionFactory.setHost("localhost");
connectionFactory.setChannelCacheSize(concurrentConsumers);
connectionFactory.setPort(BrokerTestUtils.getPort());
template.setConnectionFactory(connectionFactory);
SimpleMessageConverter messageConverter = new SimpleMessageConverter();
messageConverter.setCreateMessageIds(true);
template.setMessageConverter(messageConverter);
for (int i = 0; i < messageCount; i++) {
template.convertAndSend(queue1.getName(), new Integer(i));
template.convertAndSend(queue2.getName(), new Integer(i));
}