26 lines
963 B
Java
26 lines
963 B
Java
/*
|
|
* Copyright (c) 2017 univento.eu - All rights reserved
|
|
* You are not allowed to use, distribute or modify this code
|
|
*/
|
|
|
|
package eu.univento.commons.messaging;
|
|
|
|
import eu.univento.commons.Commons;
|
|
import io.vertx.core.json.JsonObject;
|
|
import io.vertx.rabbitmq.RabbitMQClient;
|
|
import lombok.Getter;
|
|
|
|
/**
|
|
* @author joethei
|
|
* @version 1.0
|
|
*/
|
|
public class RabbitMQ {
|
|
|
|
@Getter private RabbitMQClient client;
|
|
|
|
public RabbitMQ(String host, int port, String user, String password, String virtualHost) {
|
|
JsonObject config = new JsonObject().put("host", host).put("port", port).put("user", user).put("password", password).put("virtualHost", virtualHost).put("connectionTimeout", 60)
|
|
.put("requestedHeartbeat", 60).put("handshakeTimeout", 60).put("requestedChannelMax", 5).put("networkRecoveryInterval", 5).put("automaticRecoveryEnabled", true);
|
|
client = RabbitMQClient.create(Commons.getCommons().getVertx(), config);
|
|
}
|
|
} |