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

MultiRabbitListenerAnnotationBeanPostProcessor resolveMultiRabbitAdminName #2810

Merged
merged 21 commits into from
Sep 6, 2024
Merged

MultiRabbitListenerAnnotationBeanPostProcessor resolveMultiRabbitAdminName #2810

merged 21 commits into from
Sep 6, 2024

Conversation

ngocnhan-tran1996
Copy link
Contributor

issue #2809

Condition in MultiRabbitListenerAnnotationBeanPostProcessor#resolveMultiRabbitAdminName

  1. Get RabbitListener#admin if it's not blank else
  2. Get RabbitListener#containerFactory return RabbitListener#containerFactory + -admin if it's not blank else
  3. Get RabbitListenerConfigUtils#RABBIT_ADMIN_BEAN_NAME

in case 2, I think just get bean name from SpEL #{@...} and concate string, no need call super#resolveExpressionAsString. Wherther the given name is valid or not, function chain in class RabbitListenerAnnotationBeanPostProcessor will attempt to create RabbitAmin with it.

Please give me more advice if I miss something

Copy link
Member

@artembilan artembilan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for proposed fix!
Unfortunately we cannot go via simple expression parsing where it would simply be just a plain bean name without an expression wrapping. The point of the expression is really let to do more complex logic for that resolution.

See my comment in the respective issue to make it more robust: #2809 (comment)

Copy link
Member

@artembilan artembilan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And your name to the @author section of all the affected classes.

Copy link
Member

@artembilan artembilan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh! I see now what you mean:

 EnableRabbitTests > sampleConfiguration() FAILED
    org.opentest4j.AssertionFailedError: 
    expected: "rabbitListenerContainerFactory"
     but was: null
        at app//org.springframework.amqp.rabbit.annotation.AbstractRabbitAnnotationDrivenTests.testSampleConfiguration(AbstractRabbitAnnotationDrivenTests.java:91)
        at app//org.springframework.amqp.rabbit.annotation.EnableRabbitTests.sampleConfiguration(EnableRabbitTests.java:71)

Apparently those tests are based on some test entity.
So, yeah: we have to have these new methods implemented in that RabbitListenerContainerTestFactory as well.

Why do you push commits for every line of code you change?
Why just don't combine all the requested changes and send a single commit with a proper message?

Thanks

@ngocnhan-tran1996
Copy link
Contributor Author

And your name to the @author section of all the affected classes.

Oh! I see now what you mean:

 EnableRabbitTests > sampleConfiguration() FAILED
    org.opentest4j.AssertionFailedError: 
    expected: "rabbitListenerContainerFactory"
     but was: null
        at app//org.springframework.amqp.rabbit.annotation.AbstractRabbitAnnotationDrivenTests.testSampleConfiguration(AbstractRabbitAnnotationDrivenTests.java:91)
        at app//org.springframework.amqp.rabbit.annotation.EnableRabbitTests.sampleConfiguration(EnableRabbitTests.java:71)

Apparently those tests are based on some test entity. So, yeah: we have to have these new methods implemented in that RabbitListenerContainerTestFactory as well.

Why do you push commits for every line of code you change? Why just don't combine all the requested changes and send a single commit with a proper message?

Thanks

Sorry, my network is so lag. After reloading github page, I have seen your newest comment
I bring it back and test is passed

@artembilan artembilan merged commit bb73d05 into spring-projects:main Sep 6, 2024
3 checks passed
@artembilan
Copy link
Member

@ngocnhan-tran1996 ,

thank you for contribution; looking forward for more!

@ngocnhan-tran1996
Copy link
Contributor Author

@artembilan

Thanks for your review. I have learn a lot.

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

Successfully merging this pull request may close these issues.

2 participants