+
+ RabbitMQClient client = RabbitMQClient.create(vertx, config);
+ client.addConnectionEstablishedCallback(promise -> {
+ client.exchangeDeclare(EXCHANGE_NAME, EXCHANGE_TYPE, EXCHANGE_DURABLE, EXCHANGE_AUTO_DELETE)
+ .compose(v -> {
+ return client.queueDeclare(QUEUE_NAME, QUEUE_DURABLE, QUEUE_EXCLUSIVE, QUEUE_AUTO_DELETE);
+ })
+ .compose(declareOk -> {
+ return client.queueBind(QUEUE_NAME, EXCHANGE_NAME, "");
+ })
+ .onComplete(promise);
+ });
+
+
+ RabbitMQClient.connect(vertx, config)
+ .compose(connection -> {
+ return connection.createChannelBuilder()
+ .withChannelOpenHandler(chann -> {
+ chann.exchangeDeclare(EXCHANGE_NAME, EXCHANGE_TYPE, EXCHANGE_DURABLE, EXCHANGE_AUTO_DELETE, null);
+ chann.queueDeclare(QUEUE_NAME, QUEUE_DURABLE, QUEUE_EXCLUSIVE, QUEUE_AUTO_DELETE, null);
+ chann.queueBind(QUEUE_NAME, EXCHANGE_NAME, "", null);
+ })
+ .openChannel();
+ })
+ ;
+