Package com.kurento.kmf.rabbitmq.server

Source Code of com.kurento.kmf.rabbitmq.server.RabbitMqConnectorManager

package com.kurento.kmf.rabbitmq.server;

import java.io.IOException;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.kurento.kmf.common.Address;
import com.kurento.kmf.jsonrpcconnector.client.JsonRpcClient;
import com.kurento.kmf.rabbitmq.RabbitMqException;
import com.kurento.kmf.thrift.jsonrpcconnector.JsonRpcClientThrift;

public class RabbitMqConnectorManager {

  private static final Logger log = LoggerFactory
      .getLogger(RabbitMqConnectorManager.class);

  private JsonRpcServerRabbitMq rabbitMqToThriftConnector;

  private JsonRpcClient client;

  public RabbitMqConnectorManager(Address thriftKmsAddress,
      Address thriftKmfAddress, Address rabbitMqAddress) {

    this.client = new JsonRpcClientThrift(thriftKmsAddress.getHost(),
        thriftKmsAddress.getPort(), thriftKmfAddress.getHost(),
        thriftKmfAddress.getPort());

    log.info("Starting RabbitMQ to Thrift Media Connector");

    this.rabbitMqToThriftConnector = new JsonRpcServerRabbitMq(client,
        rabbitMqAddress);
    this.rabbitMqToThriftConnector.start();

    log.info("RabbitMQ to Thrift Media Connector started");
  }

  public void destroy() {

    try {
      this.client.close();
      this.rabbitMqToThriftConnector.destroy();
    } catch (IOException e) {
      throw new RabbitMqException(
          "Exception while destroying MediaServerBroker", e);
    }
  }
}
TOP

Related Classes of com.kurento.kmf.rabbitmq.server.RabbitMqConnectorManager

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.