[ 
https://issues.apache.org/jira/browse/ARTEMIS-2218?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Vuk Vasic updated ARTEMIS-2218:
-------------------------------
    Description: 
For some reason after running *ActiveMQ Artemis (2.6.3)* only first topic 
created can be used for shared subscription.

Steps to reproduce:
 # Create 2 consumers (with same Container ID and Subscription Name, 
Capabilities are: shared, topic and global) and 1 producer. The Artemis has 2 
producers in admin panel and uses round-robin for deliver of messages. (See 
sample amqp 1.PNG). Topic is named *sample4*
 # Remove consumers and producers for *sample4*
 # Create 2 consumers (with same Container ID and Subscription Name, 
Capabilities are: shared, topic and global) and 1 producer. The Artemis has 
only 1 producers in admin panel and it delivers message to only one listener. 
Topic is named *sample5*. (See sample amqp 2.PNG)
 # Repeat step 1 and now the topic *sample4* is also delivering to only one 
consumer. (See sample amqp 3.PNG)

 

It is interesting that if you use same topic multiple times, everything works, 
But as soon as you create new topic no shared subscription over AMQP 1.0 are 
not working.

 

*Update*

This works fine on version 1.5.6. I also tested 2.3.0 and it does not work too.

 

*New update*

Version 2.0 and 2.1 also works fine. This seems to be an issue from version 2.2 
to 2.6.3.

 

*New update:*

This issue gets more critical as 2.1 and 2.0 version have bug that if someone 
publishes to non-existent topic, after that no one can subscribe to it (No 
messages are received after that).

But if it subscribes to topic first and then someone starts sending messages 
everything is okey, This works fine with version *2.6.3* but still now there is 
no version that i can use AMQP with without any problem.

 
*New update. Reproduction of problem*

Here is the sample code i created

```
using Amqp;
using Amqp.Framing;
using Amqp.Types;
using System;
using System.Threading;

namespace AMQPArtemisIssue_2218
{
    class Program
    {
        private readonly int linkCredit = 300;
        static void Main(string[] args)
        {
            new Program(args);
            Console.ReadLine();
        }
        public Program(string[] args)
        {
            if (args.Length < 3)
            {
                return;
            }

            var clientId = args[0];
            var topic = args[1];
            var subscriptionName = args[2];
            var connectionPath = "amqp://admin:admin@localhost:5672";
            ConnectionFactory factory = new ConnectionFactory();
            factory.AMQP.ContainerId = clientId;
            Connection connection = factory.CreateAsync(new 
Address(connectionPath)).Result;


            if (subscriptionName.Equals("send"))
            {
                Target target = new Target
                {
                    Address = topic,
                    Capabilities = new Symbol[] { new Symbol("topic") }
                };
                Session sendSession = new Session(connection);
                SenderLink sender = sender = new SenderLink(sendSession, 
"sender-link-" + topic, target, null);
                while (true)
                {
                    Console.WriteLine("Message sent to topic: " + topic);
                    Message message = new Message("Hello AMQP " + 
Guid.NewGuid().ToString());
                    sender.Send(message);
                    Thread.Sleep(1000);
                }
            }
            else
            {
                Session session = new Session(connection);
                Symbol[] capabilities = capabilities = new Symbol[] { new 
Symbol("topic"), new Symbol("global"), new Symbol("shared"), new 
Symbol("SHARED-SUBS") };
                Source target = new Source
                {
                    Address = topic,
                    Durable = 2,
                    Capabilities = capabilities
                };
                ReceiverLink receiverLink = new ReceiverLink(session, 
subscriptionName, target, null);
                receiverLink.Start(linkCredit, (receiver, message) =>
                {
                    Console.WriteLine(message.Body.ToString());
                });
           
            }
        }
    }
}

```

# AMQP Artemis Issue - Steps

## To replicate the issue:

1. Run artemis 2.6.3 (i use docker)
```
docker run --name broker -eARTEMIS_USERNAME=admin -eARTEMIS_PASSWORD=admin 
-p5672:5672 -d vromero/activemq-artemis:2.6.3-alpine
```

2. Compile application and run it 3 times (2 times for consumer, 1 for 
publisher).

Arguments are:

1. ClientID 
2. Topic
3. Subscription name or "send" in order to send messages.

publisher:
```
dotnet AMQPArtemisIssue-2218.dll clienta sample1 send
```

consumer1:
```
dotnet AMQPArtemisIssue-2218.dll clientb sample1 sub1
```
consumer2:
```
dotnet AMQPArtemisIssue-2218.dll clientc sample1 sub1
```

After run you will see that round-robin works.

3. Kill consumers and publisher and run new onces with different topic same 
subscription name and clients:

```
dotnet AMQPArtemisIssue-2218.dll clientd sample2 send
```

consumer1:
```
dotnet AMQPArtemisIssue-2218.dll cliente sample2 sub1
```
consumer2:
```
dotnet AMQPArtemisIssue-2218.dll clientf sample2 sub1
```

This will not work since there should be unique subscription name per topic. 
(Only one consumer gets messages)

4. Run step 2 again. Now only one consumer will receive messages for first 
topic too.

Expectations:

I understand that subscription-name is unique per topic. But specifiying 
existing subscription name on new topic should throw error instead killing 
functionality on first topic with that subscription name

  was:
For some reason after running *ActiveMQ Artemis (2.6.3)* only first topic 
created can be used for shared subscription.

Steps to reproduce:
 # Create 2 consumers (with same Container ID and Subscription Name, 
Capabilities are: shared, topic and global) and 1 producer. The Artemis has 2 
producers in admin panel and uses round-robin for deliver of messages. (See 
sample amqp 1.PNG). Topic is named *sample4*
 # Remove consumers and producers for *sample4*
 # Create 2 consumers (with same Container ID and Subscription Name, 
Capabilities are: shared, topic and global) and 1 producer. The Artemis has 
only 1 producers in admin panel and it delivers message to only one listener. 
Topic is named *sample5*. (See sample amqp 2.PNG)
 # Repeat step 1 and now the topic *sample4* is also delivering to only one 
consumer. (See sample amqp 3.PNG)

 

It is interesting that if you use same topic multiple times, everything works, 
But as soon as you create new topic no shared subscription over AMQP 1.0 are 
not working.

 

*Update*

This works fine on version 1.5.6. I also tested 2.3.0 and it does not work too.

 

*New update*

Version 2.0 and 2.1 also works fine. This seems to be an issue from version 2.2 
to 2.6.3.

 

*New update:*

This issue gets more critical as 2.1 and 2.0 version have bug that if someone 
publishes to non-existent topic, after that no one can subscribe to it (No 
messages are received after that).

But if it subscribes to topic first and then someone starts sending messages 
everything is okey, This works fine with version *2.6.3* but still now there is 
no version that i can use AMQP with without any problem.


> AMQP 1.0 issue with Shared Subscription
> ---------------------------------------
>
>                 Key: ARTEMIS-2218
>                 URL: https://issues.apache.org/jira/browse/ARTEMIS-2218
>             Project: ActiveMQ Artemis
>          Issue Type: Bug
>          Components: AMQP
>    Affects Versions: 2.2.0, 2.3.0, 2.4.0, 2.5.0, 2.6.0, 2.6.1, 2.6.2, 2.6.3
>         Environment: For testing i used Vormeo ActiveMQ Docker image.
> Image is: *vromero/activemq-artemis:2.6.3-alpine*
>  
>            Reporter: Vuk Vasic
>            Priority: Blocker
>         Attachments: sample amqp 1.PNG, sample amqp 2.PNG, sample amqp 3.PNG
>
>
> For some reason after running *ActiveMQ Artemis (2.6.3)* only first topic 
> created can be used for shared subscription.
> Steps to reproduce:
>  # Create 2 consumers (with same Container ID and Subscription Name, 
> Capabilities are: shared, topic and global) and 1 producer. The Artemis has 2 
> producers in admin panel and uses round-robin for deliver of messages. (See 
> sample amqp 1.PNG). Topic is named *sample4*
>  # Remove consumers and producers for *sample4*
>  # Create 2 consumers (with same Container ID and Subscription Name, 
> Capabilities are: shared, topic and global) and 1 producer. The Artemis has 
> only 1 producers in admin panel and it delivers message to only one listener. 
> Topic is named *sample5*. (See sample amqp 2.PNG)
>  # Repeat step 1 and now the topic *sample4* is also delivering to only one 
> consumer. (See sample amqp 3.PNG)
>  
> It is interesting that if you use same topic multiple times, everything 
> works, But as soon as you create new topic no shared subscription over AMQP 
> 1.0 are not working.
>  
> *Update*
> This works fine on version 1.5.6. I also tested 2.3.0 and it does not work 
> too.
>  
> *New update*
> Version 2.0 and 2.1 also works fine. This seems to be an issue from version 
> 2.2 to 2.6.3.
>  
> *New update:*
> This issue gets more critical as 2.1 and 2.0 version have bug that if someone 
> publishes to non-existent topic, after that no one can subscribe to it (No 
> messages are received after that).
> But if it subscribes to topic first and then someone starts sending messages 
> everything is okey, This works fine with version *2.6.3* but still now there 
> is no version that i can use AMQP with without any problem.
>  
> *New update. Reproduction of problem*
> Here is the sample code i created
> ```
> using Amqp;
> using Amqp.Framing;
> using Amqp.Types;
> using System;
> using System.Threading;
> namespace AMQPArtemisIssue_2218
> {
>     class Program
>     {
>         private readonly int linkCredit = 300;
>         static void Main(string[] args)
>         {
>             new Program(args);
>             Console.ReadLine();
>         }
>         public Program(string[] args)
>         {
>             if (args.Length < 3)
>             {
>                 return;
>             }
>             var clientId = args[0];
>             var topic = args[1];
>             var subscriptionName = args[2];
>             var connectionPath = "amqp://admin:admin@localhost:5672";
>             ConnectionFactory factory = new ConnectionFactory();
>             factory.AMQP.ContainerId = clientId;
>             Connection connection = factory.CreateAsync(new 
> Address(connectionPath)).Result;
>             if (subscriptionName.Equals("send"))
>             {
>                 Target target = new Target
>                 {
>                     Address = topic,
>                     Capabilities = new Symbol[] { new Symbol("topic") }
>                 };
>                 Session sendSession = new Session(connection);
>                 SenderLink sender = sender = new SenderLink(sendSession, 
> "sender-link-" + topic, target, null);
>                 while (true)
>                 {
>                     Console.WriteLine("Message sent to topic: " + topic);
>                     Message message = new Message("Hello AMQP " + 
> Guid.NewGuid().ToString());
>                     sender.Send(message);
>                     Thread.Sleep(1000);
>                 }
>             }
>             else
>             {
>                 Session session = new Session(connection);
>                 Symbol[] capabilities = capabilities = new Symbol[] { new 
> Symbol("topic"), new Symbol("global"), new Symbol("shared"), new 
> Symbol("SHARED-SUBS") };
>                 Source target = new Source
>                 {
>                     Address = topic,
>                     Durable = 2,
>                     Capabilities = capabilities
>                 };
>                 ReceiverLink receiverLink = new ReceiverLink(session, 
> subscriptionName, target, null);
>                 receiverLink.Start(linkCredit, (receiver, message) =>
>                 {
>                     Console.WriteLine(message.Body.ToString());
>                 });
>            
>             }
>         }
>     }
> }
> ```
> # AMQP Artemis Issue - Steps
> ## To replicate the issue:
> 1. Run artemis 2.6.3 (i use docker)
> ```
> docker run --name broker -eARTEMIS_USERNAME=admin -eARTEMIS_PASSWORD=admin 
> -p5672:5672 -d vromero/activemq-artemis:2.6.3-alpine
> ```
> 2. Compile application and run it 3 times (2 times for consumer, 1 for 
> publisher).
> Arguments are:
> 1. ClientID 
> 2. Topic
> 3. Subscription name or "send" in order to send messages.
> publisher:
> ```
> dotnet AMQPArtemisIssue-2218.dll clienta sample1 send
> ```
> consumer1:
> ```
> dotnet AMQPArtemisIssue-2218.dll clientb sample1 sub1
> ```
> consumer2:
> ```
> dotnet AMQPArtemisIssue-2218.dll clientc sample1 sub1
> ```
> After run you will see that round-robin works.
> 3. Kill consumers and publisher and run new onces with different topic same 
> subscription name and clients:
> ```
> dotnet AMQPArtemisIssue-2218.dll clientd sample2 send
> ```
> consumer1:
> ```
> dotnet AMQPArtemisIssue-2218.dll cliente sample2 sub1
> ```
> consumer2:
> ```
> dotnet AMQPArtemisIssue-2218.dll clientf sample2 sub1
> ```
> This will not work since there should be unique subscription name per topic. 
> (Only one consumer gets messages)
> 4. Run step 2 again. Now only one consumer will receive messages for first 
> topic too.
> Expectations:
> I understand that subscription-name is unique per topic. But specifiying 
> existing subscription name on new topic should throw error instead killing 
> functionality on first topic with that subscription name



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

Reply via email to