PDA

View Full Version : Why not expose functions createXXX?


hucmuc
Dec 17th, 2004, 12:04 PM
Since spring 1.1 doesn't do async message consumption, one has to write the code. However, it would be nice to have createConnection & createConsumer as public routine from class JmsTemplate. Since I'm using jboss 3.2.x (jms 1.0.2) I had to write it as:

// Jms 1.0.2
conn = ((QueueConnectionFactory) jmsTemplate.getConnectionFactory()).createQueueCon nection();
session = ((QueueConnection) conn).createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
MessageConsumer consumer = ((QueueSession) session).createReceiver((Queue) jmsTemplate.getDefaultDestination());
consumer.setMessageListener(this);
conn.start();

It would have been cleaner if the createXXX methods were public. Why aren't they public?

Dino