Package org.apache.qpid.server.queue

Examples of org.apache.qpid.server.queue.AMQQueue


            }

            public void copy(QueueEntry entry, Queue queue)
            {
                final ServerMessage message = entry.getMessage();
                final AMQQueue toQueue = ((QueueAdapter)queue).getAMQQueue();

                txn.enqueue(toQueue, message, new ServerTransaction.Action()
                {
                    public void postCommit()
                    {
                        try
                        {
                            toQueue.enqueue(message);
                        }
                        catch(AMQException e)
                        {
                            throw new RuntimeException(e);
                        }
                    }

                    public void onRollback()
                    {
                    }
                });

            }

            public void move(final QueueEntry entry, Queue queue)
            {
                final ServerMessage message = entry.getMessage();
                final AMQQueue toQueue = ((QueueAdapter)queue).getAMQQueue();
                if(entry.acquire())
                {
                    txn.enqueue(toQueue, message,
                                new ServerTransaction.Action()
                                {

                                    public void postCommit()
                                    {
                                        try
                                        {
                                            toQueue.enqueue(message);
                                        }
                                        catch (AMQException e)
                                        {
                                            throw new RuntimeException(e);
                                        }
View Full Code Here


        return !_queues.isEmpty();
    }

    protected void onBind(final Binding binding)
    {
        AMQQueue queue = binding.getQueue();
        assert queue != null;

        Integer oldVal;

        if((oldVal = _queues.putIfAbsent(queue, ONE)) != null)
View Full Code Here

        }
    }

    protected void onUnbind(final Binding binding)
    {
        AMQQueue queue = binding.getQueue();
        Integer oldValue = _queues.get(queue);

        boolean done = false;

        while(!(done || oldValue == null))
View Full Code Here

            long deliveryTag = entry.getKey();

            //Amend the delivery counter as the client hasn't seen these messages yet.
            message.decrementDeliveryCount();

            AMQQueue queue = message.getQueue();

            // Without any details from the client about what has been processed we have to mark
            // all messages in the unacked map as redelivered.
            message.setRedelivered();

            Subscription sub = message.getDeliveredSubscription();

            if (sub != null)
            {

                if(!queue.resend(message,sub))
                {
                    msgToRequeue.put(deliveryTag, message);
                }
            }
            else
View Full Code Here

        }
        else
        {
            final ServerMessage msg = rejectedQueueEntry.getMessage();

            final AMQQueue queue = rejectedQueueEntry.getQueue();

            final Exchange altExchange = queue.getAlternateExchange();
            unackedMap.remove(deliveryTag);

            if (altExchange == null)
            {
                _logger.debug("No alternate exchange configured for queue, must discard the message as unable to DLQ: delivery tag: " + deliveryTag);
                _actor.message(_logSubject, ChannelMessages.DISCARDMSG_NOALTEXCH(msg.getMessageNumber(), queue.getName(), msg.getRoutingKey()));
                rejectedQueueEntry.discard();
                return;
            }

            final InboundMessage m = new InboundMessageAdapter(rejectedQueueEntry);
View Full Code Here

    {
        _subscriptions.remove(sub.getName());
        try
        {
            sub.getSendLock();
            AMQQueue queue = sub.getQueue();
            if(queue != null)
            {
                queue.unregisterSubscription(sub);
            }
        }
        catch (AMQException e)
        {
            // TODO
View Full Code Here

            {
                String queueName = method.getQueue();
                QueueRegistry queueRegistry = getQueueRegistry(session);


                final AMQQueue queue = queueRegistry.getQueue(queueName);

                if(queue == null)
                {
                    exception(session,method,ExecutionErrorCode.NOT_FOUND, "Queue: " + queueName + " not found");
                }
                else if(queue.getAuthorizationHolder() != null && queue.getAuthorizationHolder() != session)
                {
                    exception(session,method,ExecutionErrorCode.RESOURCE_LOCKED, "Exclusive Queue: " + queueName + " owned exclusively by another session");
                }
                else if(queue.isExclusive() && queue.getExclusiveOwningSession() != null && queue.getExclusiveOwningSession() != session)
                {
                    exception(session,method,ExecutionErrorCode.RESOURCE_LOCKED, "Exclusive Queue: " + queueName + " owned exclusively by another session");
                }
                else
                {
                    if(queue.isExclusive())
                    {
                        ServerSession s = (ServerSession) session;
                        queue.setExclusiveOwningSession(s);
                        if(queue.getAuthorizationHolder() == null)
                        {
                            queue.setAuthorizationHolder(s);
                            queue.setExclusiveOwningSession(s);
                            ((ServerSession) session).addSessionCloseTask(new ServerSession.Task()
                            {
                                public void doTask(ServerSession session)
                                {
                                    if(queue.getAuthorizationHolder() == session)
                                    {
                                        queue.setAuthorizationHolder(null);
                                        queue.setExclusiveOwningSession(null);
                                    }
                                }
                            });
                        }
                    }

                    FlowCreditManager_0_10 creditManager = new WindowCreditManager(0L,0L);

                    FilterManager filterManager = null;
                    try
                    {
                        filterManager = FilterManagerFactory.createManager(method.getArguments());
                    }
                    catch (AMQException amqe)
                    {
                        exception(session, method, ExecutionErrorCode.ILLEGAL_ARGUMENT, "Exception Creating FilterManager");
                        return;
                    }

                    Subscription_0_10 sub = SubscriptionFactoryImpl.INSTANCE.createSubscription((ServerSession)session,
                                                                  destination,
                                                                  method.getAcceptMode(),
                                                                  method.getAcquireMode(),
                                                                  MessageFlowMode.WINDOW,
                                                                  creditManager,
                                                                  filterManager,
                                                                  method.getArguments());

                    ((ServerSession)session).register(destination, sub);
                    try
                    {
                        queue.registerSubscription(sub, method.getExclusive());
                    }
                    catch (AMQQueue.ExistingExclusiveSubscription existing)
                    {
                        exception(session, method, ExecutionErrorCode.RESOURCE_LOCKED, "Queue has an exclusive consumer");
                    }
View Full Code Here

        {
            exception(session, method, ExecutionErrorCode.NOT_FOUND, "not-found: destination '"+destination+"'");
        }
        else
        {
            AMQQueue queue = sub.getQueue();
            ((ServerSession)session).unregister(sub);
            if(!queue.isDeleted() && queue.isExclusive() && queue.getConsumerCount() == 0)
            {
                queue.setAuthorizationHolder(null);
            }
        }
    }
View Full Code Here

            // should raise exception ILLEGAL_ARGUMENT "binding-key not set"
            if (!method.hasBindingKey())
            {
                method.setBindingKey(method.getQueue());
            }
            AMQQueue queue = queueRegistry.getQueue(method.getQueue());
            Exchange exchange = exchangeRegistry.getExchange(method.getExchange());
            if(queue == null)
            {
                exception(session, method, ExecutionErrorCode.NOT_FOUND, "Queue: '" + method.getQueue() + "' not found");
            }
View Full Code Here

        {
            exception(session, method, ExecutionErrorCode.ILLEGAL_ARGUMENT, "binding-key not set");
        }
        else
        {
            AMQQueue queue = queueRegistry.getQueue(method.getQueue());
            Exchange exchange = exchangeRegistry.getExchange(method.getExchange());
            if(queue == null)
            {
                exception(session, method, ExecutionErrorCode.NOT_FOUND, "Queue: '" + method.getQueue() + "' not found");
            }
View Full Code Here

TOP

Related Classes of org.apache.qpid.server.queue.AMQQueue

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.