activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Adam Lewandowski <a...@alewando.com>
Subject Re: Publishing to topic w/ PooledConnectionFactory results in UnsupportedOperationException
Date Fri, 16 Feb 2007 13:56:26 GMT

Any thoughts on this? The code to reproduce the issue is pretty
straightforward:


		ActiveMQTopic topic = new ActiveMQTopic("test");
		PooledConnectionFactory pcf = new PooledConnectionFactory();
		pcf.setConnectionFactory(new ActiveMQConnectionFactory("vm://test"));

		TopicConnection conn = (TopicConnection)pcf.createConnection();
		TopicSession session = conn.createTopicSession(false,
Session.AUTO_ACKNOWLEDGE);
		TopicPublisher publisher = session.createPublisher(topic);
		publisher.publish(session.createMessage());

This results in an UnsupportedOperationException ("A 
destination must be specified."). The destination is specified in the
constructor of 
Am I doing something wrong here? Passing the destination to the publish()
method does work, but is not an option for me since the actual publishing
code is inside of Spring's JmsTemplate class which doesn't use that idiom.




Adam Lewandowski wrote:
> 
> PooledSession does not appear to use the Topic supplied to the 
> createPublisher(topic) method, at least when obtained from 
> PooledConnectionFactory.
> When the publish(Message) method is called on the returned 
> TopicPublisher instance, an UnsupportedOperationException is thrown ("A 
> destination must be specified."). Sending to a queue does not produce 
> the same error.
> 
> Some simple digging turns up the fact that the ActiveMQTopicPublisher 
> instance nested inside PooledTopicPublisher gets initialized with a 
> ProducerInfo whose destination is null. Looks like 
> PooledSession.getTopicPublisher() is responsible for creating the 
> publisher from the contained ActiveMQSession, but does not supply a 
> destination (explicitly passes null).
> 
> I've opened issue AMQ-1161 and attached code to reproduce the error. Any 
> ideas? Am I doing something wrong?
> http://issues.apache.org/activemq/browse/AMQ-1161
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Publishing-to-topic-w--PooledConnectionFactory-results-in-UnsupportedOperationException-tf3214902s2354.html#a9004657
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Mime
View raw message