Examples of newConnection()


Examples of com.rabbitmq.client.ConnectionFactory.newConnection()

  private QueueingConsumer consumer;

  public RPCClient() throws Exception {
    ConnectionFactory factory = new ConnectionFactory();
    factory.setHost("localhost");
    connection = factory.newConnection();
    channel = connection.createChannel();
    replyQueueName = channel.queueDeclare().getQueue();
    consumer = new QueueingConsumer(channel);
    channel.basicConsume(replyQueueName, true, consumer);
  }
View Full Code Here

Examples of com.rabbitmq.client.ConnectionFactory.newConnection()

    Connection connection = null;
    Channel channel = null;
    try {
      ConnectionFactory factory = new ConnectionFactory();
      factory.setHost("localhost");
      connection = factory.newConnection();
      channel = connection.createChannel();
      channel.exchangeDeclare(EXCHANGE_NAME, "topic");
      String routingKey = getRouting(argv);
      String message = getMessage(argv);
      channel.basicPublish(EXCHANGE_NAME, routingKey, null,
View Full Code Here

Examples of com.rabbitmq.client.ConnectionFactory.newConnection()

  private final static String QUEUE_NAME = "hello";

  public static void main(String[] argv) throws Exception {
    ConnectionFactory factory = new ConnectionFactory();
    factory.setHost("localhost");
    Connection connection = factory.newConnection();
    Channel channel = connection.createChannel();
    channel.queueDeclare(QUEUE_NAME, false, false, false, null);
    String message = "Hello World!";
    channel.basicPublish("", QUEUE_NAME, null, message.getBytes());
    System.out.println(" [x] Sent '" + message + "'");
View Full Code Here

Examples of com.rabbitmq.client.ConnectionFactory.newConnection()

    Connection connection = null;
    Channel channel = null;
    try {
      ConnectionFactory factory = new ConnectionFactory();
      factory.setHost("localhost");
      connection = factory.newConnection();
      channel = connection.createChannel();
      channel.exchangeDeclare(EXCHANGE_NAME, "topic");
      String queueName = channel.queueDeclare().getQueue();
      if (argv.length < 1) {
        System.err.println("Usage: ReceiveLogsTopic [binding_key]...");
View Full Code Here

Examples of com.rabbitmq.client.ConnectionFactory.newConnection()

            factory.setVirtualHost(getVhost());
        }
        factory.setHost(getHostname());
        factory.setPort(getPortNumber());
        if (getAddresses() == null) {
            return factory.newConnection(executor);
        } else {
            return factory.newConnection(executor, getAddresses());
        }
    }
View Full Code Here

Examples of com.rabbitmq.client.ConnectionFactory.newConnection()

        factory.setHost(getHostname());
        factory.setPort(getPortNumber());
        if (getAddresses() == null) {
            return factory.newConnection(executor);
        } else {
            return factory.newConnection(executor, getAddresses());
        }
    }

    @Override
    public Producer createProducer() throws Exception {
View Full Code Here

Examples of com.rabbitmq.client.ConnectionFactory.newConnection()

        factory.setHost("localhost");
        factory.setPort(5672);
        factory.setUsername("cameltest");
        factory.setPassword("cameltest");
        factory.setVirtualHost("/");
        Connection conn = factory.newConnection();

        final List<Envelope> received = new ArrayList<Envelope>();

        Channel channel = conn.createChannel();
        channel.queueDeclare("sammyq", false, false, true, null);
View Full Code Here

Examples of com.rabbitmq.client.ConnectionFactory.newConnection()

        factory.setHost("localhost");
        factory.setPort(5672);
        factory.setUsername("cameltest");
        factory.setPassword("cameltest");
        factory.setVirtualHost("/");
        Connection conn = factory.newConnection();

        AMQP.BasicProperties.Builder properties = new AMQP.BasicProperties.Builder();
        properties.replyTo("myReply");

        Channel channel = conn.createChannel();
View Full Code Here

Examples of com.rabbitmq.client.ConnectionFactory.newConnection()

   
    Connection conn = null;
    Channel channel = null;
   
    try {
      conn = factory.newConnection();
      channel = conn.createChannel();
      PurgeOk ok = channel.queuePurge(je.getQueue());
      _logger.info("purged queue: " +je.getQueue() + " result: " + ok.toString() + " on " + je.getFetcherQConf().getHost() + "," + je.getFetcherQConf().getVhost());
      return true;
    } catch (IOException e) {
View Full Code Here

Examples of com.rabbitmq.client.ConnectionFactory.newConnection()

    factory.setPort(this.getFetcherQConf().getPort());
   
    Connection conn = null;
    Channel channel = null;
    try {
      conn = factory.newConnection();
      // in one thread
      channel = conn.createChannel();
      String exchangeName = getExchange();//"image_admin_exchange";
      String type = this.getType();
      String queueName = getQueue();//"image_admin";
View Full Code Here
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.