Package com.rabbitmq.client

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


        };

        String queueName = channel.queueDeclare().getQueue();

        channel.queueBind(queueName, exchangeName, routingKey);
        channel.basicConsume(queueName, cons);

        long id = consumerSeq++;
        consumerChannels.put(id, channel);

        return id;
View Full Code Here


                Connection connection = factory.newConnection();
                Channel channel = connection.createChannel();
                channel.queueDeclare(QUEUE_NAME,false,false,false,null);
                consumer = new QueueingConsumer(channel);

                channel.basicConsume(QUEUE_NAME, true,consumer);
               
                while(true){
                     QueueingConsumer.Delivery delivery = consumer.nextDelivery();
                     message = new String(delivery.getBody());
                     serv.setMessage(message);
View Full Code Here

            channel.queueBind(dataQueue, "testExchange", "EXPORT_REPLICATED_TABLE.#");
            String doneQueue = channel.queueDeclare().getQueue();
            channel.queueBind(doneQueue, "testExchange", "EXPORT_DONE_TABLE.#");

            // Setup callback for data stream
            channel.basicConsume(dataQueue, false, createConsumer(channel));

            // Setup callback for the done message
            QueueingConsumer doneConsumer = new QueueingConsumer(channel);
            channel.basicConsume(doneQueue, true, doneConsumer);
View Full Code Here

            // Setup callback for data stream
            channel.basicConsume(dataQueue, false, createConsumer(channel));

            // Setup callback for the done message
            QueueingConsumer doneConsumer = new QueueingConsumer(channel);
            channel.basicConsume(doneQueue, true, doneConsumer);

            // Wait until the done message arrives, then verify count
            final QueueingConsumer.Delivery doneMsg = doneConsumer.nextDelivery();
            final long expectedRows = Long.parseLong(ExportOnServerVerifier.RoughCSVTokenizer
                    .tokenize(new String(doneMsg.getBody(), Charsets.UTF_8))[6]);
View Full Code Here

            createExchange(channel, amqpExchangeName);
            channel.queueDeclare(queueName, false, false, false, null);
            channel.queueBind(queueName, amqpExchangeName, bindingKey);

            // register a callback handler to receive the events that a subscriber subscribed to
            channel.basicConsume(queueName, s_autoAck, queueName, new DefaultConsumer(channel) {
                @Override
                public void handleDelivery(String queueName, Envelope envelope, AMQP.BasicProperties properties, byte[] body) throws IOException {
                    Ternary<String, Channel, EventSubscriber> queueDetails = s_subscribers.get(queueName);
                    if (queueDetails != null) {
                        EventSubscriber subscriber = queueDetails.third();
View Full Code Here

                        createExchange(channel, amqpExchangeName);
                        channel.queueDeclare(subscriberId, false, false, false, null);
                        channel.queueBind(subscriberId, amqpExchangeName, bindingKey);

                        // register a callback handler to receive the events that a subscriber subscribed to
                        channel.basicConsume(subscriberId, s_autoAck, subscriberId, new DefaultConsumer(channel) {
                            @Override
                            public void handleDelivery(String queueName, Envelope envelope, AMQP.BasicProperties properties, byte[] body) throws IOException {

                                Ternary<String, Channel, EventSubscriber> subscriberDetails = s_subscribers.get(queueName); // queue name == subscriber ID
View Full Code Here

      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

        Queue queue = this.queue();
        Channel channel = queue.channel();

        try {
            String tag =
                channel.basicConsume(
                        queue.name(),
                        this.isAutoAcknowledged(),
                        new DispatchingConsumer(channel, aMessageListener));

            this.setTag(tag);
View Full Code Here

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

        Channel channel = conn.createChannel();
        channel.queueDeclare("sammyq", false, false, true, null);
        channel.queueBind("sammyq", EXCHANGE, "");
        channel.basicConsume("sammyq", true, new DefaultConsumer(channel) {
            @Override
            public void handleDelivery(String consumerTag,
                                       Envelope envelope,
                                       AMQP.BasicProperties properties,
                                       byte[] body) throws IOException {
View Full Code Here

            // java.lang.String queue, boolean durable, boolean exclusive, boolean autoDelete, java.util.Map<java.lang.String,java.lang.Object> arguments
            channel.queueDeclare(queueName, false, false, true, null);

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

            int count = 0;
            while(true) {
                final QueueingConsumer.Delivery msg = consumer.nextDelivery(1);
                if (msg == null) {
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.