Git Product home page Git Product logo

Comments (5)

artembilan avatar artembilan commented on March 29, 2024

Well, pay attention, please, to the @RabbitListener with bindings configurations.
We found it as already enough complicated.
And from other hand see the HeadersExchange description and its binding logic in the HeadersExchangeMapConfigurer. For example:

BindingBuilder.bind(new Queue("q"))
                .to(new HeadersExchange("t"))
                .where("foo")
                .matches("bar");

But there are other configuration logical branches.

So, we decided do not allow HeadersExchange from the annotation configuration and let end-users to do their sophisticated solutions with standard BindingBuilder and @Bean combinations:

@Bean
public DirectExchange e1() {
    return new DirectExchange("e1", false, true);
}

@Bean
public Queue q1() {
    return new Queue("q1", false, false, true);
}

@Bean
public Binding b1() {
    return BindingBuilder.bind(q1()).to(e1()).with("k1");
}

Ultimately, the @RabbitListener is just for listener's method on the queue. And from big height it shouldn't know anything about bindings.

Hope that is clear

from spring-amqp.

garyrussell avatar garyrussell commented on March 29, 2024

The javadocs document this limitation.

None of the exchanges declared by the @QueueBinding annotations support an arguments map - it's a bit awkward to build a map using annotations.

Since the headers exchange requires arguments for the header mapping and x-match argument, we couldn't support it without adding argument support, hence it's not currently supported.

The work around (and for any exchange requiring arguments) is to use external @Bean definitions.

We can revisit this if you feel strongly about it - if so, open a JIRA Issue and we'll take a look.

We'd need to add something like

Argument[] arguments default {}

Where Argument would be an annotation, something like:

  {  @Argument(name="x-match", value="all",
     @Argument(name="foo", value="bar",
     @Argument(name="baz", value="qux" }

Now I see it laid out like that, it doesn't look like it would be too bad; however, if you configured queue arguments as well, the annotation could get very unwieldy, very quickly, and hard to read - hence my original thought that such configuration would be better done as @Beans.

from spring-amqp.

SergiusSidorov avatar SergiusSidorov commented on March 29, 2024

The idea with the array of arguments looks great. In my opinion, this solution looks complete (all type of exchanges will be supported).
Write bindings on annotations isn't very nice solution. But this has a right to exist. Especially since it is already there for other types of exchanges.

from spring-amqp.

garyrussell avatar garyrussell commented on March 29, 2024

https://jira.spring.io/browse/AMQP-604

from spring-amqp.

artembilan avatar artembilan commented on March 29, 2024

The PR #409 has been merged 54a613a

from spring-amqp.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.