Package com.rabbitmq.client

Examples of com.rabbitmq.client.Consumer


        public void run() throws Exception {
            ConnectionFactory factory = new ConnectionFactory();
            factory.setUri(uri);
            final CountDownLatch[] latch = new CountDownLatch[1];
            long time = System.nanoTime();
            Consumer cons = new ClientConsumer(latch);
            Connection conn = null;
            Channel ch = null;
            if (reuseConnection) {
                conn = factory.newConnection();
                ch = conn.createChannel();
View Full Code Here


                    // wrap the incoming consumer with a proxy, then invoke
                    if (method.getName().equals(BASIC_CONSUME_METHOD_NAME)) {

                        // Consumer is always the last argument, let it fail if not
                        Consumer targetConsumer = (Consumer) args[args.length - 1];

                        // already wrapped?
                        if (!(targetConsumer instanceof HaConsumerProxy)) {

                            // check to see if we already have a proxied Consumer
View Full Code Here

                // so return false
                return false;
            } else if (method instanceof Basic.Cancel) {
                Basic.Cancel m = (Basic.Cancel)method;
                String consumerTag = m.getConsumerTag();
                Consumer callback = _consumers.remove(consumerTag);
                if (callback == null) {
                    callback = defaultConsumer;
                }
                if (callback != null) {
                    try {
View Full Code Here

    }

    protected void processDelivery(Command command, Basic.Deliver method) {
        Basic.Deliver m = method;

        Consumer callback = _consumers.get(m.getConsumerTag());
        if (callback == null) {
            if (defaultConsumer == null) {
                // No handler set. We should blow up as this message
                // needs acking, just dropping it is not enough. See bug
                // 22587 for discussion.
View Full Code Here

    /** Public API - {@inheritDoc} */
    public void basicCancel(final String consumerTag)
        throws IOException
    {
        final Consumer originalConsumer = _consumers.get(consumerTag);
        if (originalConsumer == null)
            throw new IOException("Unknown consumerTag");
        BlockingRpcContinuation<Consumer> k = new BlockingRpcContinuation<Consumer>() {
            public Consumer transformReply(AMQCommand replyCommand) {
                replyCommand.getMethod();
View Full Code Here

                try {
                    lock.lockInterruptibly();
                    if (!isRunning) {
                        // start up again
                        try {
                            Consumer consumer = new UrlConsumer(channel());
                            channel().queueDeclare(getQueueName(), false, false, true, null);
                            channel().queueBind(getQueueName(), getExchange(), getQueueName());
                            channel().basicConsume(getQueueName(), false, consumer);
                            isRunning = true;
                            logger.info("started AMQP consumer uri=" + getAmqpUri() + " exchange=" + getExchange() + " queueName=" + getQueueName());
View Full Code Here

                                final String forwardAddress)
        throws IOException
    {
        Channel channel = getChannel();

        Consumer cons = new MessageTransformingConsumer(channel, defaultContentType) {
            public void doHandle(final String consumerTag,
                                 final Envelope envelope,
                                 final AMQP.BasicProperties properties,
                                 final JsonObject body)
                throws IOException
View Full Code Here

            new JsonObject().putString("baz", "bap");

        EventBus eb = getVertx().eventBus();

        // build the endpoint for the module to deliver to
        Consumer cons = new DefaultConsumer(chan) {
            public void handleDelivery(final String consumerTag,
                                       final Envelope envelope,
                                       final AMQP.BasicProperties props,
                                       final byte[] body)
                throws IOException
View Full Code Here

            }
            // }}}
        });

        // build the AMQP client endpoint for the module to deliver to
        Consumer cons = new DefaultConsumer(chan) {
            public void handleDelivery(final String consumerTag,
                                       final Envelope envelope,
                                       final AMQP.BasicProperties props,
                                       final byte[] body)
                throws IOException
View Full Code Here

        EventBus eb = getVertx().eventBus();



        // build the AMQP client endpoint for the module to deliver to
        Consumer cons = new DefaultConsumer(chan) {
            public void handleDelivery(final String consumerTag,
                                       final Envelope envelope,
                                       final AMQP.BasicProperties props,
                                       final byte[] body)
                throws IOException
View Full Code Here

TOP

Related Classes of com.rabbitmq.client.Consumer

Copyright © 2018 www.massapicom. 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.