Examples of basicConsume()


Examples of com.rabbitmq.client.Channel.basicConsume()

      channel.queueBind(queueName, EXCHANGE_NAME, bindingKey);

      System.out.println(" [*] " + _consumerId + " Waiting for messages on " + bindingKey + ". To exit press CTRL+C");

      QueueingConsumer consumer = new QueueingConsumer(channel);
      channel.basicConsume(queueName, true, consumer);

      while (true)
      {
        QueueingConsumer.Delivery delivery = consumer.nextDelivery();
        String message = new String(delivery.getBody());
View Full Code Here

Examples of com.rabbitmq.client.Channel.basicConsume()

      System.out.println(" [*] " + _consumerId + " Waiting for messages on " + bindingKey
          + ". To exit press CTRL+C");

      QueueingConsumer consumer = new QueueingConsumer(channel);
      channel.basicConsume(queueName, true, consumer);

      while (true) {
        QueueingConsumer.Delivery delivery = consumer.nextDelivery();
        String message = new String(delivery.getBody());
        String routingKey = delivery.getEnvelope().getRoutingKey();
View Full Code Here

Examples of com.rabbitmq.client.Channel.basicConsume()

        }
        try {
          Channel chan = connection.getConnection().createChannel();
          chan.queueDeclarePassive(amqpQueue);
          AmqpConsumer consumer = new AmqpConsumer(chan, connection.getName());
          chan.basicConsume(amqpQueue, false, consumer);
          channels.add(chan);
        } catch (Exception e) {
          logger.log(BasicLevel.ERROR,
              "Error while starting consumer on connection: " + connection.getName(), e);
        }
View Full Code Here

Examples of com.rabbitmq.client.Channel.basicConsume()

                String queueName = channel.queueDeclare().getQueue();
                channel.queueBind(queueName, AMQPUtil.EXCHANGE_NAME_TOPIC, topic.getNativeKey());

                QueueingConsumer consumer = new QueueingConsumer(channel);
                channel.basicConsume(queueName, true, consumer);

                while (true) {
                    QueueingConsumer.Delivery delivery = consumer.nextDelivery();
                    String message = new String(delivery.getBody());
View Full Code Here

Examples of com.rabbitmq.client.Channel.basicConsume()

                String queueName = channel.queueDeclare().getQueue();
                channel.queueBind(queueName, AMQPUtil.EXCHANGE_NAME_FANOUT, "");

                QueueingConsumer consumer = new QueueingConsumer(channel);
                channel.basicConsume(queueName, true, consumer);

                while (true) {
                    QueueingConsumer.Delivery delivery = consumer.nextDelivery();
                    String message = new String(delivery.getBody());
View Full Code Here

Examples of com.rabbitmq.client.Channel.basicConsume()

                String queueName = channel.queueDeclare().getQueue();
                channel.queueBind(queueName, AMQPUtil.EXCHANGE_NAME_DIRECT, key.getNativeKey());

                QueueingConsumer consumer = new QueueingConsumer(channel);
                channel.basicConsume(queueName, true, consumer);

                while (true) {
                    QueueingConsumer.Delivery delivery = consumer.nextDelivery();
                    String message = new String(delivery.getBody());
View Full Code Here

Examples of com.rabbitmq.client.Channel.basicConsume()

            availableChannels.put(channelID, channel);
            String queueName = channel.queueDeclare().getQueue();

            BasicConsumer consumer = new
                    BasicConsumer(new JSONMessageParser(), localPublisher);          // here we use local publisher
            channel.basicConsume(queueName, true, consumer);
            String filterString = CommonUtils.getRoutingKey(monitorID.getUserName(), hostAddress);
            // here we queuebind to a particular user in a particular machine
            channel.queueBind(queueName, "glue2.computing_activity", filterString);
            logger.info("Using filtering string to monitor: " + filterString);
        } catch (IOException e) {
View Full Code Here

Examples of com.rabbitmq.client.Channel.basicConsume()

    Connection connection = factory.newConnection();
    Channel channel = connection.createChannel();
    channel.queueDeclare(QUEUE_NAME, false, false, false, null);
    System.out.println(" [*] Waiting for messages. To exit press CTRL+C");
    QueueingConsumer consumer = new QueueingConsumer(channel);
    channel.basicConsume(QUEUE_NAME, true, consumer);
    while (true) {
      QueueingConsumer.Delivery delivery = consumer.nextDelivery();
      String message = new String(delivery.getBody());
      System.out.println(" [x] Received '" + message + "'");
    }
View Full Code Here

Examples of com.rabbitmq.client.Channel.basicConsume()

    channel.exchangeDeclare(EXCHANGE_NAME, "fanout");
    String queueName = channel.queueDeclare().getQueue();
    channel.queueBind(queueName, EXCHANGE_NAME, "");
    System.out.println(" [*] Waiting for messages. To exit press CTRL+C");
    QueueingConsumer consumer = new QueueingConsumer(channel);
    channel.basicConsume(queueName, true, consumer);
    while (true) {
      QueueingConsumer.Delivery delivery = consumer.nextDelivery();
      String message = new String(delivery.getBody());
      System.out.println(" [x] Received '" + message + "'");
    }
View Full Code Here

Examples of com.rabbitmq.client.Channel.basicConsume()

    for (String severity : argv) {
      channel.queueBind(queueName, EXCHANGE_NAME, severity);
    }
    System.out.println(" [*] Waiting for messages. To exit press CTRL+C");
    QueueingConsumer consumer = new QueueingConsumer(channel);
    channel.basicConsume(queueName, true, consumer);
    while (true) {
      QueueingConsumer.Delivery delivery = consumer.nextDelivery();
      String message = new String(delivery.getBody());
      String routingKey = delivery.getEnvelope().getRoutingKey();
      System.out.println(" [x] Received '" + routingKey + "':'" + message
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.