Configuring RabbitAdmin

RabbitAdmin is used to declare the exchanges, queues, and binding that needs to be ready on startup. RabbitAdmin does the automatic declaration of the queues, exchanges, and binding. The main benefit of this auto-declaration is that if the connection is disconnected for some reason, they will be applied automatically when the connection is re-established. The following code configures RabbitAdmin:

@Beanpublic RabbitAdmin rabbitAdmin() {    RabbitAdmin admin = new RabbitAdmin(connectionFactory());    admin.declareQueue(queue());    admin.declareExchange(exchange());    admin.declareBinding(exchangeBinding(exchange(), queue()));    return admin;}

rabbitAdmin() will declare the Queue, Exchange, and Binding. The RabbitAdmin constructor ...

Get Hands-On High Performance with Spring 5 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.