[ 
https://issues.apache.org/jira/browse/ARTEMIS-330?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15069865#comment-15069865
 ] 

clebert suconic commented on ARTEMIS-330:
-----------------------------------------

createQueue doesn't create the queue either, it creates the queue Object. 

The Broker is configured to pre-create queues. Whenever you lookup for a queue 
non existent it will create.
Topics has a bit more into that, so some extra verifications needs to be done. 
We couldn't come up with rules that would allow createTopic on every scenario. 
We may improve that later but that's how it works at the time.

> Unable to create Topic via Session object
> -----------------------------------------
>
>                 Key: ARTEMIS-330
>                 URL: https://issues.apache.org/jira/browse/ARTEMIS-330
>             Project: ActiveMQ Artemis
>          Issue Type: Bug
>          Components: Broker
>    Affects Versions: 1.1.0
>         Environment: Ubuntu 15.10, JDK 8
>            Reporter: Grzegorz Poznachowski
>
> Running code as simple as:
> {code:java}
> public static void main(final String[] args) throws Exception {
>         TransportConfiguration transport = new 
> TransportConfiguration(NettyConnectorFactory.class.getName(), new 
> HashMap<>());
>         ActiveMQConnectionFactory cf = 
> ActiveMQJMSClient.createConnectionFactoryWithoutHA(JMSFactoryType.CF, 
> transport);
>         Connection connection = cf.createConnection();
>         Session session = connection.createSession(false, 
> Session.AUTO_ACKNOWLEDGE);
>         Queue queue = session.createQueue("someQueue");
>         MessageProducer producer = session.createProducer(queue);
>         connection.start();
>         connection.stop();
>     }
> {code}
> would result in creating Queue on the server. However it is not possible to 
> the same for topic:
> {code:java}
>        Topic topic = session.createTopic("someTopic");
>        MessageProducer producer = session.createProducer(topic);
> {code}
> would result in an error:
> {panel}
> Exception in thread "main" javax.jms.InvalidDestinationException: Destination 
> exampleTopic does not exist
>       at 
> org.apache.activemq.artemis.jms.client.ActiveMQSession.createProducer(ActiveMQSession.java:288)
>       at 
> org.apache.activemq.artemis.jms.example.TopicExample.main(TopicExample.java:53)
>       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>       at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>       at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>       at java.lang.reflect.Method.invoke(Method.java:497)
>       at com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)
> {panel}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to