You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by Adam Lewandowski <ad...@alewando.com> on 2007/02/12 17:49:32 UTC

Publishing to topic w/ PooledConnectionFactory results in UnsupportedOperationException

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


Re: Publishing to topic w/ PooledConnectionFactory results in UnsupportedOperationException

Posted by James Strachan <ja...@gmail.com>.
I've patched trunk to fix this issue

On 2/16/07, Adam Lewandowski <ad...@alewando.com> wrote:
>
> 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.
>
>


-- 

James
-------
http://radio.weblogs.com/0112098/

Re: Publishing to topic w/ PooledConnectionFactory results in UnsupportedOperationException

Posted by Adam Lewandowski <ad...@alewando.com>.
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.