You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@activemq.apache.org by "clebert suconic (JIRA)" <ji...@apache.org> on 2015/12/23 16:32:46 UTC

[jira] [Commented] (ARTEMIS-330) Unable to create Topic via Session object

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

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

You have to create the topic on the broker. createTopic will only create the Topic Object, not the actual configuration on the server's.


Look at the topic example.

> 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)