Examples of QueueRecord


Examples of org.apache.qpid.server.store.berkeleydb.records.QueueRecord

            // Addition for Version 2 of this table, read the queue arguments
            FieldTable arguments = FieldTableEncoding.readFieldTable(tupleInput);
            // Addition for Version 3 of this table, read the queue exclusivity
            boolean exclusive = tupleInput.readBoolean();

            return new QueueRecord(name, owner, exclusive, arguments);
        }
        catch (DatabaseException e)
        {
            _logger.error("Unable to create binding: " + e, e);
            return null;
View Full Code Here

Examples of org.apache.qpid.server.store.berkeleydb.records.QueueRecord

            AMQShortString name = AMQShortStringEncoding.readShortString(tupleInput);
            AMQShortString owner = AMQShortStringEncoding.readShortString(tupleInput);
            // Addition for Version 2 of this table, read the queue arguments
            FieldTable arguments = FieldTableEncoding.readFieldTable(tupleInput);

            return new QueueRecord(name, owner, false, arguments);
        }
        catch (DatabaseException e)
        {
            _logger.error("Unable to create binding: " + e, e);
            return null;
View Full Code Here

Examples of org.apache.qpid.server.store.berkeleydb.records.QueueRecord

            DatabaseEntry key = new DatabaseEntry();
            DatabaseEntry value = new DatabaseEntry();
            TupleBinding binding = _queueTupleBindingFactory.getInstance();
            while (cursor.getNext(key, value, LockMode.RMW) == OperationStatus.SUCCESS)
            {
                QueueRecord queueRecord = (QueueRecord) binding.entryToObject(value);
               
                String queueName = queueRecord.getNameShortString() == null ? null :
                                        queueRecord.getNameShortString().asString();
                String owner = queueRecord.getOwner() == null ? null :
                                        queueRecord.getOwner().asString();
                boolean exclusive = queueRecord.isExclusive();
               
                FieldTable arguments = queueRecord.getArguments();

                qrh.queue(queueName, owner, exclusive, arguments);
            }

        }
View Full Code Here

Examples of org.apache.qpid.server.store.berkeleydb.records.QueueRecord

        if (_log.isDebugEnabled())
        {
            _log.debug("public void createQueue(AMQQueue queue(" + queue.getName() + ") = " + queue + "): called");
        }
       
        QueueRecord queueRecord= new QueueRecord(queue.getNameShortString(),
                                                queue.getOwner(), queue.isExclusive(), arguments);
       
        createQueue(queueRecord);
    }
View Full Code Here

Examples of org.apache.qpid.server.store.berkeleydb.records.QueueRecord

            OperationStatus status = _queueDb.get(null, key, value, LockMode.DEFAULT);
            if(status == OperationStatus.SUCCESS)
            {
                //read the existing record and apply the new exclusivity setting
                QueueRecord queueRecord = (QueueRecord) queueBinding.entryToObject(value);
                queueRecord.setExclusive(queue.isExclusive());
               
                //write the updated entry to the store
                queueBinding.objectToEntry(queueRecord, newValue);
               
                _queueDb.put(null, key, newValue);
View Full Code Here

Examples of org.apache.qpid.server.store.berkeleydb.records.QueueRecord

        DatabaseVisitor queueVisitor = new DatabaseVisitor()
        {
            public void visit(DatabaseEntry key, DatabaseEntry value) throws AMQStoreException
            {
                QueueRecord queueRec = (QueueRecord) queueTupleBinding.entryToObject(value);
                AMQShortString queueName = queueRec.getNameShortString();

                //if the queue name is in the gathered list then set its exclusivity true
                if (durableSubQueues.contains(queueName))
                {
                    _logger.info("Marking as possible DurableSubscription backing queue: " + queueName);
                    queueRec.setExclusive(true);
                }
               
                //The simple call to createQueue with the QueueRecord object is sufficient for a v2->v3 upgrade as
                //the extra 'exclusive' property in v3 will be defaulted to false in the record creation.
                _newMessageStore.createQueue(queueRec);

                _count++;
                existingQueues.add(queueName);
            }
        };
        _oldMessageStore.visitQueues(queueVisitor);

        logCount(queueVisitor.getVisitedCount(), "Queue");


        // Look for persistent messages stored for non-durable queues
        _logger.info("Checking for messages previously sent to non-durable queues");

        // track all message delivery to existing queues
        final HashSet<Long> queueMessages = new HashSet<Long>();

        // hold all non existing queues and their messages IDs
        final HashMap<String, HashSet<Long>> phantomMessageQueues = new HashMap<String, HashSet<Long>>();

        // delivery DB visitor to check message delivery and identify non existing queues
        final QueueEntryTB queueEntryTB = new QueueEntryTB();
        DatabaseVisitor messageDeliveryCheckVisitor = new DatabaseVisitor()
        {
            public void visit(DatabaseEntry key, DatabaseEntry value) throws DatabaseException
            {
                QueueEntryKey entryKey = (QueueEntryKey) queueEntryTB.entryToObject(key);
                Long messageId = entryKey.getMessageId();
                AMQShortString queueName = entryKey.getQueueName();
                if (!existingQueues.contains(queueName))
                {
                    String name = queueName.asString();
                    HashSet<Long> messages = phantomMessageQueues.get(name);
                    if (messages == null)
                    {
                        messages = new HashSet<Long>();
                        phantomMessageQueues.put(name, messages);
                    }
                    messages.add(messageId);
                    _count++;
                }
                else
                {
                    queueMessages.add(messageId);
                }
            }
        };
        _oldMessageStore.visitDelivery(messageDeliveryCheckVisitor);

        if (phantomMessageQueues.isEmpty())
        {
            _logger.info("No such messages were found");
        }
        else
        {
            _logger.info("Found " + messageDeliveryCheckVisitor.getVisitedCount()+ " such messages in total");

            for (Entry<String, HashSet<Long>> phantomQueue : phantomMessageQueues.entrySet())
            {
                String queueName = phantomQueue.getKey();
                HashSet<Long> messages = phantomQueue.getValue();

                _logger.info(MessageFormat.format("There are {0} messages which were previously delivered to non-durable queue ''{1}''",messages.size(), queueName));

                boolean createQueue;
                if(!_interactive)
                {
                    createQueue = true;
                    _logger.info("Running in batch-mode, marking queue as durable to ensure retention of the messages.");
                }
                else
                {
                    createQueue = userInteract("Do you want to make this queue durable?\n"
                                             + "NOTE: Answering No will result in these messages being discarded!");
                }

                if (createQueue)
                {
                    for (Long messageId : messages)
                    {
                        queueMessages.add(messageId);
                    }
                    AMQShortString name = new AMQShortString(queueName);
                    existingQueues.add(name);
                    QueueRecord record = new QueueRecord(name, null, false, null);
                    _newMessageStore.createQueue(record);
                }
            }
        }
View Full Code Here

Examples of org.apache.qpid.server.store.berkeleydb.records.QueueRecord

                    {
                        queueMessages.add(messageId);
                    }
                    AMQShortString name = new AMQShortString(queueName);
                    existingQueues.add(name);
                    QueueRecord record = new QueueRecord(name, null, false, null);
                    _newMessageStore.createQueue(record);
                }
            }
        }
View Full Code Here

Examples of org.apache.qpid.server.store.berkeleydb.records.QueueRecord

            _newMessageStore = newMessageStore;
        }

        public void visit(DatabaseEntry key, DatabaseEntry value) throws AMQStoreException
        {
            QueueRecord queueRec = _queueTupleBinding.entryToObject(value);
            AMQShortString queueName = queueRec.getNameShortString();

            //if the queue name is in the gathered list then set its exclusivity true
            if (_durableSubQueues.contains(queueName))
            {
                _logger.info("Marking as possible DurableSubscription backing queue: " + queueName);
                queueRec.setExclusive(true);
            }

            //The simple call to createQueue with the QueueRecord object is sufficient for a v2->v3 upgrade as
            //the extra 'exclusive' property in v3 will be defaulted to false in the record creation.
            _newMessageStore.createQueue(queueRec);
View Full Code Here

Examples of org.apache.qpid.server.store.berkeleydb.records.QueueRecord

            DatabaseEntry key = new DatabaseEntry();
            DatabaseEntry value = new DatabaseEntry();
            TupleBinding binding = _queueTupleBindingFactory.getInstance();
            while (cursor.getNext(key, value, LockMode.RMW) == OperationStatus.SUCCESS)
            {
                QueueRecord queueRecord = (QueueRecord) binding.entryToObject(value);

                String queueName = queueRecord.getNameShortString() == null ? null :
                                        queueRecord.getNameShortString().asString();
                String owner = queueRecord.getOwner() == null ? null :
                                        queueRecord.getOwner().asString();
                boolean exclusive = queueRecord.isExclusive();

                FieldTable arguments = queueRecord.getArguments();

                qrh.queue(queueName, owner, exclusive, arguments);
            }

        }
View Full Code Here

Examples of org.apache.qpid.server.store.berkeleydb.records.QueueRecord

        if (_log.isDebugEnabled())
        {
            _log.debug("public void createQueue(AMQQueue queue(" + queue.getName() + ") = " + queue + "): called");
        }

        QueueRecord queueRecord= new QueueRecord(queue.getNameShortString(),
                                                queue.getOwner(), queue.isExclusive(), arguments);

        createQueue(queueRecord);
    }
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.