8 Şubat 2021 Pazartesi

SpringBoot Amqp RabbitAdmin Sınıfı

declareBinding metodu
Örnek
Şöyle yaparız
@Autowired
private RabbitAdmin rabbitAdmin;

public void addNewQueue(String queueName, String exchangeName, String routingKey) {
  Queue queue = new Queue(queueName, true, false, false);
  Binding binding = new Binding(
    queueName,
    Binding.DestinationType.QUEUE,
    exchangeName,
    routingKey,
    null
   );
  rabbitAdmin.declareQueue(queue);
  rabbitAdmin.declareBinding(binding);
}
deleteQueue metodu
Örnek
Şöyle yaparız
String queueName = ...
rabbitAdmin.deleteQueue(queueName);


Hiç yorum yok:

Yorum Gönder