Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't create a pair link due of Attach.LinkName override #582

Closed
Gsantomaggio opened this issue May 14, 2024 · 7 comments
Closed

Can't create a pair link due of Attach.LinkName override #582

Gsantomaggio opened this issue May 14, 2024 · 7 comments

Comments

@Gsantomaggio
Copy link

The issue was already raised here #360

Description

I will try to propose an easy solution ( let's hope).
Btw, given this code:

        var receiveAttach = new Attach()
        {
            
            SndSettleMode = SenderSettleMode.Settled,
            RcvSettleMode = ReceiverSettleMode.First,
            Properties = new Fields
            {
                {new Symbol("paired"), true}
            },
            LinkName = "management-link-pair",
            Source = new Source()
            {
                Address = "/management",
                ExpiryPolicy = new Symbol("LINK_DETACH"),
                Timeout = 0,
                Dynamic = false,
                Durable = 0,
            },
            Handle = 1,
            Target = new Target()
            {
                Address = "/management",
                ExpiryPolicy = new Symbol("SESSION_END"),
                Timeout = 0,
                Dynamic = false,
                
            },
        };
        
        var sender = new SenderLink(
            managementSession, "sender", senderAttach, (link, attach1) =>
            {
                testOutputHelper.WriteLine("Attached");
            });
        
        var receiver = new ReceiverLink(
            managementSession, "receive", receiveAttach, (link, attach1) =>
            {
                testOutputHelper.WriteLine("Attached");
            });

The library will replace the LinkName with the name

In this case, each value you set to the Attach.LinkName will be replaced.
The library does not allow the use of the same name:

var sender = new SenderLink(
            managementSession, "mylink", senderAttach, (link, attach1) =>
            {
                testOutputHelper.WriteLine("Attached");
            });
        
        var receiver = new ReceiverLink(
            managementSession, "mylink", receiveAttach, (link, attach1) =>
            {
                testOutputHelper.WriteLine("Attached");
            });

raises: mylink has been attached

To create the pair the linkname must be unique ref: https://docs.oasis-open.org/amqp/linkpair/v1.0/cs01/linkpair-v1.0-cs01.html#_Toc51331304

Possible solution(?)

I am not sure it can work but the easy solution would be like this:

if (attach.LinkName == String.Empty){
   attach.LinkName = this.name;
}

Thank you

@xinchen10
Copy link
Member

I am fixing the bug by including link role in link name comparison.

@Gsantomaggio
Copy link
Author

Thank you

@michaelklishin
Copy link

@xinchen10 thank you. Much appreciated by the entire RabbitMQ team!

@xinchen10
Copy link
Member

I made the changes. Now it should allow the same name for two links with different roles.

@Gsantomaggio
Copy link
Author

It works. Thank you

@Gsantomaggio
Copy link
Author

@xinchen10 may I ask when the new version will be released? thank you

@xinchen10
Copy link
Member

Version 2.4.10 is released.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants