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

Benjamin Graf edited comment on ARTEMIS-550 at 1/26/18 8:10 AM:
----------------------------------------------------------------

Hi [~gtully]

I created a test case which only works if the queue is created explicitly 
before.
{code:java}
 @Test
    public void testVirtualTopicViaFQQN() throws Exception {
        ConnectionFactory factory = new 
org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory(urlString);
        server.addAddressInfo(new AddressInfo(new SimpleString("#"), 
RoutingType.MULTICAST));                      
        
server.getAddressSettingsRepository().getMatch("#").setAutoCreateQueues(true);
        server.createQueue(new SimpleString("TEST_TOPIC"),
                RoutingType.MULTICAST,
                new SimpleString("VirtualTopicConsumers.test"),
                null, true, false, -1, false, true);
        try (Connection connection = factory.createConnection()) {
            connection.start();
            Session session = connection.createSession(false, 
Session.AUTO_ACKNOWLEDGE);
            Topic topic = session.createTopic("TEST_TOPIC");
            Queue queue = 
session.createQueue("TEST_TOPIC::VirtualTopicConsumers.test");
            MessageConsumer consumer1 = session.createConsumer(queue);
            MessageProducer producer = session.createProducer(topic);
            producer.send(session.createMessage());
            Message m = consumer1.receive(2000);
            assertNotNull(m);
        }
    }
 {code}
 AMQSession does create queue in createConsumer()  ServerSessionImpl throws 
Exception in createConsumer() if binding is not available.

Snapshot from debugging what CREATE_QUEUE_V2 tries to add (ServerSessionImpl  
createQueue()):

!image-2018-01-26-09-02-08-192.png!

That's why createConsumer() fails! Root of this create query comes from 
ActiveMQSession createConsumer().


was (Author: graben):
Hi [~gtully]

I created a test case which only works if the queue is created explicitly 
before.
{code:java}
 @Test
    public void testVirtualTopicViaFQQN() throws Exception {
        ConnectionFactory factory = new 
org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory(urlString);
        server.addAddressInfo(new AddressInfo(new SimpleString("#"), 
RoutingType.MULTICAST));                      
        
server.getAddressSettingsRepository().getMatch("#").setAutoCreateQueues(true);
        server.createQueue(new SimpleString("TEST_TOPIC"),
                RoutingType.MULTICAST,
                new SimpleString("VirtualTopicConsumers.test"),
                null, true, false, -1, false, true);
        try (Connection connection = factory.createConnection()) {
            connection.start();
            Session session = connection.createSession(false, 
Session.AUTO_ACKNOWLEDGE);
            Topic topic = session.createTopic("TEST_TOPIC");
            Queue queue = 
session.createQueue("TEST_TOPIC::VirtualTopicConsumers.test");
            MessageConsumer consumer1 = session.createConsumer(queue);
            MessageProducer producer = session.createProducer(topic);
            producer.send(session.createMessage());
            Message m = consumer1.receive(2000);
            assertNotNull(m);
        }
    }
 {code}
 AMQSession does create queue in createConsumer()  ServerSessionImpl throws 
Exception in createConsumer() if binding is not available.

Snapshot from debugging what CREATE_QUEUE_V2 tries to add (ServerSessionImpl  
createQueue()):

!image-2018-01-26-09-02-08-192.png!

That's why createConsumer() fails!

> Add support for virtual topic consumers
> ---------------------------------------
>
>                 Key: ARTEMIS-550
>                 URL: https://issues.apache.org/jira/browse/ARTEMIS-550
>             Project: ActiveMQ Artemis
>          Issue Type: Improvement
>          Components: Broker
>    Affects Versions: 1.3.0
>            Reporter: Benjamin Graf
>            Assignee: Martyn Taylor
>            Priority: Major
>         Attachments: image-2018-01-26-09-02-08-192.png
>
>
> Artemis should support virtual topic consumers as alternative to topic 
> subscriptions as ActiveMQ itself does.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to