GrapeBaBa
GrapeBaBa

Reputation: 1411

how to use @queuebinding with @rabbitlistener?

Seems since spring-amqp version 1.5, there is a new annotation @queuebinding。But how to use it, i don't know if it can be used on a class or a method? Does it exist any example?

Upvotes: 10

Views: 14108

Answers (1)

Artem Bilan
Artem Bilan

Reputation: 121550

Not sure what problem you have, but here is a sample exactly from the Reference Manual:

@Component
public class MyService {

  @RabbitListener(bindings = @QueueBinding(
        value = @Queue(value = "myQueue", durable = "true"),
        exchange = @Exchange(value = "auto.exch"),
        key = "orderRoutingKey")
  )
  public void processOrder(String data) {
    ...
  }

And yes, it can be use as on class level as well as on method level.

Upvotes: 17

Related Questions