Example usage for com.rabbitmq.client ConnectionFactory setUri

List of usage examples for com.rabbitmq.client ConnectionFactory setUri

Introduction

In this page you can find the example usage for com.rabbitmq.client ConnectionFactory setUri.

Prototype

public void setUri(String uriString)
        throws URISyntaxException, NoSuchAlgorithmException, KeyManagementException 

Source Link

Document

Convenience method for setting the fields in an AMQP URI: host, port, username, password and virtual host.

Usage

From source file:Process.java

public void procesar() {
    System.out.println("Paso2");
    ConnectionFactory factory = new ConnectionFactory();
    try {//  w  ww  .  j  av a 2s.com
        System.out.println("Paso3");
        factory.setUri(uri);
        Connection connection = factory.newConnection();
        Channel channel = connection.createChannel();
        QueueingConsumer consumer = new QueueingConsumer(channel);
        channel.basicConsume("hello", true, consumer);

        while (true) {
            QueueingConsumer.Delivery delivery = consumer.nextDelivery();
            String mensaje = new String(delivery.getBody());
            System.out.println(" [x] Received '" + mensaje + "'");
            System.out.println("Procesando..." + mensaje + "-" + Calendar.getInstance());
            PlanPago pp = dao.leer(new Long(mensaje));
            if (pp.getLinea() != null) {
                //generar cuota
                List<Cuota> cuotas = aa.generarCuotas(pp.getValor(), pp.getLinea().getTasa(), pp.getPlazo());
                pp.setCuotas(cuotas);
                //calcular nivel de riesgo
                pp.setNivelRiesgo(calcularNivelRiesgo());
                pp.setEstado("Generado");
                //guardar cuota
                dao.actualizar(pp);
                for (Cuota c : pp.getCuotas()) {
                    c.setIdPlan(pp.getId());
                }
                dao2.insertar(pp.getCuotas());
            }
            System.out.println("Finalizo " + mensaje + "-" + Calendar.getInstance());

        }

    } catch (URISyntaxException ex) {
        Logger.getLogger(Process.class.getName()).log(Level.SEVERE, null, ex);
    } catch (NoSuchAlgorithmException ex) {
        Logger.getLogger(Process.class.getName()).log(Level.SEVERE, null, ex);
    } catch (KeyManagementException ex) {
        Logger.getLogger(Process.class.getName()).log(Level.SEVERE, null, ex);
    } catch (IOException ex) {
        Logger.getLogger(Process.class.getName()).log(Level.SEVERE, null, ex);
    } catch (InterruptedException ex) {
        Logger.getLogger(Process.class.getName()).log(Level.SEVERE, null, ex);
    }

    //listenerContainer.setConnectionFactory(rabbitConnectionFactory);
    //listenerContainer.setQueueNames(rabbitQueue.getName());

    // set the callback for message handling
    /*listenerContainer.setMessageListener(new MessageListener() {
    public void onMessage(Message message) {
        final String mensaje = (String) messageConverter.fromMessage(message);
                
        // simply printing out the operation, but expensive computation could happen here
        System.out.println("Received from RabbitMQ: " + mensaje);
                
    }
    });
            
    // set a simple error handler
    /*listenerContainer.setErrorHandler(new ErrorHandler() {
    public void handleError(Throwable t) {
        t.printStackTrace();
    }
    });
            
    // register a shutdown hook with the JVM
    Runtime.getRuntime().addShutdownHook(new Thread() {
    @Override
    public void run() {
        System.out.println("Shutting down BigOperationWorker");
        listenerContainer.shutdown();
    }
    });
            
    // start up the listener. this will block until JVM is killed.
    listenerContainer.start();
    System.out.println("BigOperationWorker started");
        */

}

From source file:brooklyn.entity.messaging.rabbit.RabbitEc2LiveTest.java

License:Apache License

private Channel getAmqpChannel(RabbitBroker rabbit) throws Exception {
    String uri = rabbit.getAttribute(MessageBroker.BROKER_URL);
    LOG.warn("connecting to rabbit {}", uri);
    ConnectionFactory factory = new ConnectionFactory();
    factory.setUri(uri);
    Connection conn = factory.newConnection();
    Channel channel = conn.createChannel();
    return channel;
}

From source file:brooklyn.entity.messaging.rabbit.RabbitIntegrationTest.java

License:Apache License

private Channel getAmqpChannel(RabbitBroker rabbit) throws Exception {
    String uri = rabbit.getAttribute(MessageBroker.BROKER_URL);
    log.warn("connecting to rabbit {}", uri);
    ConnectionFactory factory = new ConnectionFactory();
    factory.setUri(uri);
    Connection conn = factory.newConnection();
    Channel channel = conn.createChannel();
    return channel;
}

From source file:co.edu.uniandes.cloud.simuladorcredito.negocio.Process.java

public void procesar() {

    ConnectionFactory factory = new ConnectionFactory();
    try {//from   ww w. ja  v a  2s. c om
        factory.setUri(uri);
        Connection connection = factory.newConnection();
        Channel channel = connection.createChannel();
        QueueingConsumer consumer = new QueueingConsumer(channel);
        channel.basicConsume("hello", true, consumer);

        while (true) {
            QueueingConsumer.Delivery delivery = consumer.nextDelivery();
            String mensaje = new String(delivery.getBody());
            System.out.println(" [x] Received '" + mensaje + "'");
            System.out.println("Procesando..." + mensaje + "-" + Calendar.getInstance());
            PlanPago pp = dao.leer(new Long(mensaje));
            if (pp.getLinea() != null) {
                //generar cuota
                List<Cuota> cuotas = aa.generarCuotas(pp.getValor(), pp.getLinea().getTasa(), pp.getPlazo());
                pp.setCuotas(cuotas);
                //calcular nivel de riesgo
                pp.setNivelRiesgo(calcularNivelRiesgo());
                pp.setEstado("Generado");
                //guardar cuota
                dao.actualizar(pp);
                for (Cuota c : pp.getCuotas()) {
                    c.setIdPlan(pp.getId());
                }
                dao2.insertar(pp.getCuotas());
            }
            System.out.println("Finalizo " + mensaje + "-" + Calendar.getInstance());

        }

    } catch (URISyntaxException ex) {
        Logger.getLogger(Process.class.getName()).log(Level.SEVERE, null, ex);
    } catch (NoSuchAlgorithmException ex) {
        Logger.getLogger(Process.class.getName()).log(Level.SEVERE, null, ex);
    } catch (KeyManagementException ex) {
        Logger.getLogger(Process.class.getName()).log(Level.SEVERE, null, ex);
    } catch (IOException ex) {
        Logger.getLogger(Process.class.getName()).log(Level.SEVERE, null, ex);
    } catch (InterruptedException ex) {
        Logger.getLogger(Process.class.getName()).log(Level.SEVERE, null, ex);
    }

    //listenerContainer.setConnectionFactory(rabbitConnectionFactory);
    //listenerContainer.setQueueNames(rabbitQueue.getName());

    // set the callback for message handling
    /*listenerContainer.setMessageListener(new MessageListener() {
    public void onMessage(Message message) {
        final String mensaje = (String) messageConverter.fromMessage(message);
                
        // simply printing out the operation, but expensive computation could happen here
        System.out.println("Received from RabbitMQ: " + mensaje);
                
    }
    });
            
    // set a simple error handler
    /*listenerContainer.setErrorHandler(new ErrorHandler() {
    public void handleError(Throwable t) {
        t.printStackTrace();
    }
    });
            
    // register a shutdown hook with the JVM
    Runtime.getRuntime().addShutdownHook(new Thread() {
    @Override
    public void run() {
        System.out.println("Shutting down BigOperationWorker");
        listenerContainer.shutdown();
    }
    });
            
    // start up the listener. this will block until JVM is killed.
    listenerContainer.start();
    System.out.println("BigOperationWorker started");
        */

}

From source file:com.audaexplore.b2b.GenAddFnol.java

private void publishFnol(List<Fnol> fnolList) {
    String amqpURI = null;//from   ww w. ja  v a  2 s.c o  m
    ConnectionFactory factory = null;
    Channel channel = null;
    Connection connection = null;
    String message;
    String BOUND_SERVICES_ENV_VARIABLE_NAME = "VCAP_SERVICES";
    Map<String, String> env = System.getenv();
    String boundServicesJson = env.get(BOUND_SERVICES_ENV_VARIABLE_NAME);
    //String boundServicesJson="{\"staging_env_json\":{},\"running_env_json\":{},\"system_env_json\":{\"VCAP_SERVICES\":{\"cloudamqp\":[{\"name\":\"MQRabbit\",\"label\":\"cloudamqp\",\"tags\":[\"Web-based\",\"UserProvisioning\",\"MessagingandQueuing\",\"amqp\",\"Backup\",\"SingleSign-On\",\"NewProduct\",\"rabbitmq\",\"CertifiedApplications\",\"Android\",\"DeveloperTools\",\"DevelopmentandTestTools\",\"Buyable\",\"Messaging\",\"Importable\",\"ITManagement\"],\"plan\":\"lemur\",\"credentials\":{\"uri\":\"amqp://kujcbqju:xr-HKmBcq5Lv87CCrYlQ6NaVmunhU8cv@moose.rmq.cloudamqp.com/kujcbqju\",\"http_api_uri\":\"https://kujcbqju:xr-HKmBcq5Lv87CCrYlQ6NaVmunhU8cv@moose.rmq.cloudamqp.com/api/\"}}],\"newrelic\":[{\"name\":\"NewRelic\",\"label\":\"newrelic\",\"tags\":[\"Monitoring\"],\"plan\":\"standard\",\"credentials\":{\"licenseKey\":\"a8a96a124d1b58d708a2c4c07c6cff8938e2e2f4\"}}],\"mongolab\":[{\"name\":\"MongoDB\",\"label\":\"mongolab\",\"tags\":[\"DataStore\",\"document\",\"mongodb\"],\"plan\":\"sandbox\",\"credentials\":{\"uri\":\"mongodb://CloudFoundry_31lvrquo_j44bi0vu_3gjp7i4s:6RAtFVBfQUCe_DV7LAq5uCffOXaEXdly@ds047315.mongolab.com:47315/CloudFoundry_31lvrquo_j44bi0vu\"}}]}},\"application_env_json\":{\"VCAP_APPLICATION\":{\"limits\":{\"mem\":512,\"disk\":1024,\"fds\":16384},\"application_id\":\"87bdc475-83c4-4df9-92d1-40ff9bf82249\",\"application_version\":\"52891578-5906-4846-9231-afe7048f29bf\",\"application_name\":\"vinservice\",\"application_uris\":[\"vinservice.cfapps.io\"],\"version\":\"52891578-5906-4846-9231-afe7048f29bf\",\"name\":\"vinservice\",\"space_name\":\"development\",\"space_id\":\"d33d438c-860a-46d3-ab33-4c2efac841be\",\"uris\":[\"vinservice.cfapps.io\"],\"users\":null}}}";

    if (StringUtils.isNotBlank(boundServicesJson)) {
        //amqpURI =  JsonPath.read(boundServicesJson, "$..cloudamqp[0].credentials.uri",String.class);
        JSONArray jsonArray = JsonPath.read(boundServicesJson, "$..cloudamqp[0].credentials.uri");
        amqpURI = jsonArray.get(0).toString();
    } else {
        amqpURI = "amqp://localhost";
    }

    System.out.println("Sending messages to " + amqpURI);
    //System.exit(0);

    try {
        factory = new ConnectionFactory();
        factory.setUri(amqpURI);
        connection = factory.newConnection();
        channel = connection.createChannel();
        channel.queueDeclare("fnol", true, false, false, null);
    } catch (IOException e1) {
        // TODO Auto-generated catch block
        e1.printStackTrace();
    } catch (TimeoutException e1) {
        // TODO Auto-generated catch block
        e1.printStackTrace();
    } catch (KeyManagementException e1) {
        e1.printStackTrace();
    } catch (NoSuchAlgorithmException e1) {
        e1.printStackTrace();
    } catch (URISyntaxException e1) {
        e1.printStackTrace();
    }

    for (Fnol fnol : fnolList) {
        message = new Gson().toJson(fnol);

        try {
            channel.basicPublish("amq.direct", "fnolKey",
                    new AMQP.BasicProperties.Builder().contentType("text/plain").deliveryMode(2).build(),
                    //MessageProperties.PERSISTENT_TEXT_PLAIN,
                    message.getBytes());
            System.out.println("message " + message + " was published");
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }

    try {
        channel.close();
        connection.close();
    } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    } catch (TimeoutException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }

}

From source file:com.audaexplore.b2b.GenAddFnol.java

private void publishCars(List<Car> carList) {
    String amqpURI = null;//  w  w w .j a v  a2 s.c  o  m
    ConnectionFactory factory = null;
    Channel channel = null;
    Connection connection = null;
    String message;
    String BOUND_SERVICES_ENV_VARIABLE_NAME = "VCAP_SERVICES";
    Map<String, String> env = System.getenv();
    String boundServicesJson = env.get(BOUND_SERVICES_ENV_VARIABLE_NAME);
    //String boundServicesJson="{\"staging_env_json\":{},\"running_env_json\":{},\"system_env_json\":{\"VCAP_SERVICES\":{\"cloudamqp\":[{\"name\":\"MQRabbit\",\"label\":\"cloudamqp\",\"tags\":[\"Web-based\",\"UserProvisioning\",\"MessagingandQueuing\",\"amqp\",\"Backup\",\"SingleSign-On\",\"NewProduct\",\"rabbitmq\",\"CertifiedApplications\",\"Android\",\"DeveloperTools\",\"DevelopmentandTestTools\",\"Buyable\",\"Messaging\",\"Importable\",\"ITManagement\"],\"plan\":\"lemur\",\"credentials\":{\"uri\":\"amqp://kujcbqju:xr-HKmBcq5Lv87CCrYlQ6NaVmunhU8cv@moose.rmq.cloudamqp.com/kujcbqju\",\"http_api_uri\":\"https://kujcbqju:xr-HKmBcq5Lv87CCrYlQ6NaVmunhU8cv@moose.rmq.cloudamqp.com/api/\"}}],\"newrelic\":[{\"name\":\"NewRelic\",\"label\":\"newrelic\",\"tags\":[\"Monitoring\"],\"plan\":\"standard\",\"credentials\":{\"licenseKey\":\"a8a96a124d1b58d708a2c4c07c6cff8938e2e2f4\"}}],\"mongolab\":[{\"name\":\"MongoDB\",\"label\":\"mongolab\",\"tags\":[\"DataStore\",\"document\",\"mongodb\"],\"plan\":\"sandbox\",\"credentials\":{\"uri\":\"mongodb://CloudFoundry_31lvrquo_j44bi0vu_3gjp7i4s:6RAtFVBfQUCe_DV7LAq5uCffOXaEXdly@ds047315.mongolab.com:47315/CloudFoundry_31lvrquo_j44bi0vu\"}}]}},\"application_env_json\":{\"VCAP_APPLICATION\":{\"limits\":{\"mem\":512,\"disk\":1024,\"fds\":16384},\"application_id\":\"87bdc475-83c4-4df9-92d1-40ff9bf82249\",\"application_version\":\"52891578-5906-4846-9231-afe7048f29bf\",\"application_name\":\"vinservice\",\"application_uris\":[\"vinservice.cfapps.io\"],\"version\":\"52891578-5906-4846-9231-afe7048f29bf\",\"name\":\"vinservice\",\"space_name\":\"development\",\"space_id\":\"d33d438c-860a-46d3-ab33-4c2efac841be\",\"uris\":[\"vinservice.cfapps.io\"],\"users\":null}}}";

    if (StringUtils.isNotBlank(boundServicesJson)) {
        //amqpURI =  JsonPath.read(boundServicesJson, "$..cloudamqp[0].credentials.uri",String.class);
        JSONArray jsonArray = JsonPath.read(boundServicesJson, "$..cloudamqp[0].credentials.uri");
        amqpURI = jsonArray.get(0).toString();
    } else {
        amqpURI = "amqp://localhost";
    }

    System.out.println("Sending messages to " + amqpURI);
    //System.exit(0);

    try {
        factory = new ConnectionFactory();
        factory.setUri(amqpURI);
        connection = factory.newConnection();
        channel = connection.createChannel();
        channel.queueDeclare("fnol", true, false, false, null);
    } catch (IOException e1) {
        // TODO Auto-generated catch block
        e1.printStackTrace();
    } catch (TimeoutException e1) {
        // TODO Auto-generated catch block
        e1.printStackTrace();
    } catch (KeyManagementException e1) {
        e1.printStackTrace();
    } catch (NoSuchAlgorithmException e1) {
        e1.printStackTrace();
    } catch (URISyntaxException e1) {
        e1.printStackTrace();
    }

    for (Car car : carList) {
        message = new Gson().toJson(car);

        try {
            channel.basicPublish("amq.direct", "fnolKey",
                    new AMQP.BasicProperties.Builder().contentType("text/plain").deliveryMode(2).build(),
                    //MessageProperties.PERSISTENT_TEXT_PLAIN,
                    message.getBytes());
            System.out.println("message " + message + " was published");
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }

    try {
        channel.close();
        connection.close();
    } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    } catch (TimeoutException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }

}

From source file:com.audaexplore.claimservices.listeners.FnolMessageListener.java

public FnolMessageListener() {
    // init messaging    
    ConnectionFactory factory = null;
    String amqpURI = "amqp://localhost";
    Connection connection = null;
    String BOUND_SERVICES_ENV_VARIABLE_NAME = "VCAP_SERVICES";
    Map<String, String> env = System.getenv();
    String boundServicesJson = env.get(BOUND_SERVICES_ENV_VARIABLE_NAME);
    // String/*  w  ww . j  a va  2  s.com*/
    // boundServicesJson="{\"staging_env_json\":{},\"running_env_json\":{},\"system_env_json\":{\"VCAP_SERVICES\":{\"cloudamqp\":[{\"name\":\"MQRabbit\",\"label\":\"cloudamqp\",\"tags\":[\"Web-based\",\"UserProvisioning\",\"MessagingandQueuing\",\"amqp\",\"Backup\",\"SingleSign-On\",\"NewProduct\",\"rabbitmq\",\"CertifiedApplications\",\"Android\",\"DeveloperTools\",\"DevelopmentandTestTools\",\"Buyable\",\"Messaging\",\"Importable\",\"ITManagement\"],\"plan\":\"lemur\",\"credentials\":{\"uri\":\"amqp://kujcbqju:xr-HKmBcq5Lv87CCrYlQ6NaVmunhU8cv@moose.rmq.cloudamqp.com/kujcbqju\",\"http_api_uri\":\"https://kujcbqju:xr-HKmBcq5Lv87CCrYlQ6NaVmunhU8cv@moose.rmq.cloudamqp.com/api/\"}}],\"newrelic\":[{\"name\":\"NewRelic\",\"label\":\"newrelic\",\"tags\":[\"Monitoring\"],\"plan\":\"standard\",\"credentials\":{\"licenseKey\":\"a8a96a124d1b58d708a2c4c07c6cff8938e2e2f4\"}}],\"mongolab\":[{\"name\":\"MongoDB\",\"label\":\"mongolab\",\"tags\":[\"DataStore\",\"document\",\"mongodb\"],\"plan\":\"sandbox\",\"credentials\":{\"uri\":\"mongodb://CloudFoundry_31lvrquo_j44bi0vu_3gjp7i4s:6RAtFVBfQUCe_DV7LAq5uCffOXaEXdly@ds047315.mongolab.com:47315/CloudFoundry_31lvrquo_j44bi0vu\"}}]}},\"application_env_json\":{\"VCAP_APPLICATION\":{\"limits\":{\"mem\":512,\"disk\":1024,\"fds\":16384},\"application_id\":\"87bdc475-83c4-4df9-92d1-40ff9bf82249\",\"application_version\":\"52891578-5906-4846-9231-afe7048f29bf\",\"application_name\":\"vinservice\",\"application_uris\":[\"vinservice.cfapps.io\"],\"version\":\"52891578-5906-4846-9231-afe7048f29bf\",\"name\":\"vinservice\",\"space_name\":\"development\",\"space_id\":\"d33d438c-860a-46d3-ab33-4c2efac841be\",\"uris\":[\"vinservice.cfapps.io\"],\"users\":null}}}";

    if (StringUtils.isNotBlank(boundServicesJson)) {
        // amqpURI = JsonPath.read(boundServicesJson,
        // "$..cloudamqp[0].credentials.uri",String.class);
        JSONArray jsonArray = JsonPath.read(boundServicesJson, "$..cloudamqp[0].credentials.uri");
        amqpURI = jsonArray.get(0).toString();
    } else {
        amqpURI = "amqp://localhost";
    }

    System.out.println(amqpURI);

    try {
        factory = new ConnectionFactory();
        factory.setUri(amqpURI);
        connection = factory.newConnection();
        channel = connection.createChannel();
        channel.queueDeclare("fnol", true, false, false, null);
    } catch (IOException e1) {
        // TODO Auto-generated catch block
        e1.printStackTrace();
    } catch (TimeoutException e1) {
        // TODO Auto-generated catch block
        e1.printStackTrace();
    } catch (KeyManagementException e1) {
        e1.printStackTrace();
    } catch (NoSuchAlgorithmException e1) {
        e1.printStackTrace();
    } catch (URISyntaxException e1) {
        e1.printStackTrace();
    }
}

From source file:com.caucho.v5.pipe.rabbit.RabbitPipeImpl.java

License:Open Source License

private void connect() throws Exception {
    ConnectionFactory factory = new ConnectionFactory();
    factory.setUri(_config.uri());

    try {// w  w  w.j a  va2s .c  om
        _conn = factory.newConnection();
        _channel = _conn.createChannel();

        AMQP.Queue.DeclareOk responseQueue = _channel.queueDeclare(_config.queue(), _config.durable(),
                _config.exclusive(), _config.autoDelete(), null);

        if (!"".equals(_config.exchange())) {
            AMQP.Exchange.DeclareOk responseExchange = _channel.exchangeDeclare(_config.exchange(),
                    _config.exchangeType(), _config.durable(), _config.autoDelete(), false, null);

            _channel.queueBind(responseQueue.getQueue(), _config.exchange(), _config.routingKey());
        }

        _logger.log(Level.INFO, "connect: " + _id + ", actual queue=" + responseQueue.getQueue() + ", "
                + _config + " . " + _self);
    } catch (Exception e) {
        closeChannel();
        closeConnection();

        throw e;
    }
}

From source file:com.esri.geoevent.test.performance.rabbitmq.RabbitMQEventConsumer.java

License:Apache License

@Override
public void init(Config config) throws TestException {
    super.init(config);

    uri = config.getPropertyValue("uri");
    exchangeName = config.getPropertyValue("exchangeName");
    queueName = config.getPropertyValue("queueName");
    routingKey = config.getPropertyValue("routingKey");

    if (uri == null) {
        throw new TestException("RabbitMQ event consumer ERROR: 'uri' property must be specified");
    }//from  w w  w  .  j a  v  a 2s  .com
    if (exchangeName == null) {
        throw new TestException("RabbitMQ event consumer ERROR: 'exchangeName' property must be specified");
    }
    if (queueName == null) {
        throw new TestException("RabbitMQ event consumer ERROR: 'queueName' property must be specified");
    }

    try {
        ConnectionFactory factory = new ConnectionFactory();
        factory.setUri(uri);
        connection = factory.newConnection();
        channel = connection.createChannel();
        channel.queueDeclare(queueName, false, false, true, null);
        channel.queueBind(queueName, exchangeName, routingKey);
        // channel.basicQos(1);
        consumer = new QueueingConsumer(channel);
        channel.basicConsume(queueName, true, consumer);
    } catch (Exception error) {
        throw new TestException(
                ImplMessages.getMessage("INIT_FAILURE", getClass().getName(), error.getMessage()), error);
    }
}

From source file:com.esri.geoevent.test.performance.rabbitmq.RabbitMQEventProducer.java

License:Apache License

@Override
public void init(Config config) throws TestException {
    super.init(config);

    uri = config.getPropertyValue("uri");
    exchangeName = config.getPropertyValue("exchangeName");
    queueName = config.getPropertyValue("queueName");
    routingKey = config.getPropertyValue("routingKey");

    if (uri == null) {
        throw new TestException("RabbitMQ event producer ERROR: 'uri' property must be specified");
    }/*  w w w  . j a v  a2 s .  c om*/
    if (exchangeName == null) {
        throw new TestException("RabbitMQ event producer ERROR: 'exchangeName' property must be specified");
    }
    if (queueName == null) {
        throw new TestException("RabbitMQ event producer ERROR: 'queueName' property must be specified");
    }

    try {
        ConnectionFactory factory = new ConnectionFactory();
        factory.setUri(uri);
        connection = factory.newConnection();
        channel = connection.createChannel();
        channel.queueDeclare(queueName, false, false, true, null);
        channel.queueBind(queueName, exchangeName, routingKey);
    } catch (Exception error) {
        throw new TestException(
                ImplMessages.getMessage("INIT_FAILURE", getClass().getName(), error.getMessage()), error);
    }
}