[
https://issues.apache.org/jira/browse/ARTEMIS-322?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15411092#comment-15411092
]
Justin Bertram commented on ARTEMIS-322:
----------------------------------------
Wildfly 10.0.0.Final shipped with ActiveMQ Artemis 1.1.0. The first ActiveMQ
Artemis release with the fixes for this JIRA is 1.3.0 (as the JIRA itself
indicates). Therefore, Wildfly 10.0.0.Final will not have the fixes for this
JIRA.
I only have a passing familiarity with JBossMQ so I can't really address your
point there. I don't believe ActiveMQ Artemis descended from the JBossMQ
code-base so I'm clear on how this is particularly relevant.
My experience is there are lots of different messaging use-cases which carry
unique expectations so I'm not sure I'd agree with a blanket statement like,
"It is unreasonable to expect developers to manage Topic and Queue's at an
Administration level." I'm sure that expectation is unreasonable for certain
use-cases, but it's not hard for me to imagine alternative use-cases where the
opposite is true. In any event, the feature has been implemented in a
configurable way so that it can be turned off or left on as necessary.
> Implement Topic Auto-create
> ---------------------------
>
> Key: ARTEMIS-322
> URL: https://issues.apache.org/jira/browse/ARTEMIS-322
> Project: ActiveMQ Artemis
> Issue Type: New Feature
> Components: Broker
> Affects Versions: 1.1.0
> Environment: CentOS, Java 1.7, Eclipse, Artemis 1.1.0
> Reporter: Roan
> Assignee: Justin Bertram
> Labels: newbie
> Fix For: 1.3.0
>
>
> I was running a Topic example, as listed bellow.
> {code:title=TestCase.java|borderStyle=solid}
> @Test
> public void testSendTextMessageToDestination() throws Exception {
> Publisher pub = new Publisher();
> pub.create("5", "topic");
> pub.sendName("Roan", "Monteiro");
> String greeting1 = new Subscriber().getGreeting(1000);
> assertEquals("Hello Roan Monteiro!", greeting1);
> pub.closeConnection();
> }
> {code}
> Where my publisher and subscriber are:
> {code:title=Publisher.java|borderStyle=solid}
> package com.redhat.messaging.topicagents;
> import javax.jms.Connection;
> import javax.jms.ConnectionFactory;
> import javax.jms.JMSException;
> import javax.jms.MessageProducer;
> import javax.jms.Session;
> import javax.jms.TextMessage;
> import javax.jms.Topic;
> import org.apache.activemq.artemis.api.core.TransportConfiguration;
> import org.apache.activemq.artemis.api.jms.ActiveMQJMSClient;
> import org.apache.activemq.artemis.api.jms.JMSFactoryType;
> import
> org.apache.activemq.artemis.core.remoting.impl.netty.NettyConnectorFactory;
> import org.slf4j.Logger;
> import org.slf4j.LoggerFactory;
> /**
> * Non-Durable Subscrition
> * @author roanbrasil
> *
> */
> public class Publisher {
> private static final Logger LOGGER = LoggerFactory
> .getLogger(Publisher.class);
> private String clientId;
> private Connection connection;
> private Session session;
> private MessageProducer messageProducer;
> public void create(String clientId, String topicName) throws JMSException
> {
> this.clientId = clientId;
> // create a Connection Factory
> TransportConfiguration transportConfiguration = new
> TransportConfiguration(
> NettyConnectorFactory.class.getName());
> ConnectionFactory cf = ActiveMQJMSClient
>
> .createConnectionFactoryWithoutHA(JMSFactoryType.TOPIC_CF,
> transportConfiguration);
> // create a Connection
> connection = cf.createConnection();
> connection.setClientID(clientId);
> // create a Session
> session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
> // create the Topic to which messages will be sent
> Topic topic = session.createTopic(topicName);
> // create a MessageProducer for sending messages
> messageProducer = session.createProducer(topic);
> }
> public void closeConnection() throws JMSException {
> connection.close();
> }
> public void sendName(String firstName, String lastName) throws
> JMSException {
> String text = firstName + " " + lastName;
> // create a JMS TextMessage
> TextMessage textMessage = session.createTextMessage(text);
> // send the message to the topic destination
> messageProducer.send(textMessage);
> LOGGER.debug(clientId + ": sent message with text='{}'", text);
> }
> }
> {code}
> {code:title=Subscriber.java|borderStyle=solid}
> package com.redhat.messaging.topicagents;
> import javax.jms.Connection;
> import javax.jms.ConnectionFactory;
> import javax.jms.JMSException;
> import javax.jms.Message;
> import javax.jms.MessageConsumer;
> import javax.jms.Session;
> import javax.jms.TextMessage;
> import javax.jms.Topic;
> import org.apache.activemq.artemis.api.core.TransportConfiguration;
> import org.apache.activemq.artemis.api.jms.ActiveMQJMSClient;
> import org.apache.activemq.artemis.api.jms.JMSFactoryType;
> import
> org.apache.activemq.artemis.core.remoting.impl.netty.NettyConnectorFactory;
> import org.slf4j.Logger;
> import org.slf4j.LoggerFactory;
> public class Subscriber {
> private static final Logger LOGGER = LoggerFactory
> .getLogger(Subscriber.class);
> private static final String NO_GREETING = "no greeting";
> private String clientId;
> private Connection connection;
> private Session session;
> private MessageConsumer messageConsumer;
> public void create(String clientId, String topicName) throws JMSException
> {
> this.clientId = clientId;
> // create a Connection Factory
> TransportConfiguration transportConfiguration = new
> TransportConfiguration(
> NettyConnectorFactory.class.getName());
> ConnectionFactory cf = ActiveMQJMSClient
>
> .createConnectionFactoryWithoutHA(JMSFactoryType.TOPIC_CF,
> transportConfiguration);
> // create a Connection
> connection = cf.createConnection();
> connection.setClientID(clientId);
> // create a Session
> session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
> // create the Topic from which messages will be received
> Topic topic = session.createTopic(topicName);
> // create a MessageConsumer for receiving messages
> messageConsumer = session.createConsumer(topic);
> // start the connection in order to receive messages
> connection.start();
> }
> public void closeConnection() throws JMSException {
> connection.close();
> }
> public String getGreeting(int timeout) throws JMSException {
> String greeting = NO_GREETING;
> // read a message from the topic destination
> Message message = messageConsumer.receive(timeout);
> // check if a message was received
> if (message != null) {
> // cast the message to the correct type
> TextMessage textMessage = (TextMessage) message;
> // retrieve the message content
> String text = textMessage.getText();
> LOGGER.debug(clientId + ": received message with text='{}'",
> text);
> // create greeting
> greeting = "Hello " + text + "!";
> } else {
> LOGGER.debug(clientId + ": no message received");
> }
> LOGGER.info("greeting={}", greeting);
> return greeting;
> }
> }
> {code}
> When I got to ChannelImpl.class is created a temporary Topic which the name
> is jms.temptopic.topic. On the packet variable the type is 49 and the channel
> Id is 11. But the sendBlocking return the response variable with no
> queueNames and setting exists as false, I believe this queueName should come
> with topic name and the exists variable as true value.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)