Search in sources :

Example 1 with IDCounterEncoding

use of org.apache.activemq.artemis.core.persistence.impl.journal.BatchingIDGenerator.IDCounterEncoding in project activemq-artemis by apache.

the class DescribeJournal method newObjectEncoding.

public static Object newObjectEncoding(RecordInfo info, JournalStorageManager storageManager) {
    ActiveMQBuffer buffer = ActiveMQBuffers.wrappedBuffer(info.data);
    long id = info.id;
    int rec = info.getUserRecordType();
    switch(rec) {
        case ADD_LARGE_MESSAGE_PENDING:
            {
                PendingLargeMessageEncoding lmEncoding = new PendingLargeMessageEncoding();
                lmEncoding.decode(buffer);
                return lmEncoding;
            }
        case ADD_LARGE_MESSAGE:
            {
                LargeServerMessage largeMessage = new LargeServerMessageImpl(storageManager);
                LargeMessagePersister.getInstance().decode(buffer, largeMessage);
                return new MessageDescribe(largeMessage);
            }
        case ADD_MESSAGE:
            {
                return "ADD-MESSAGE is not supported any longer, use export/import";
            }
        case ADD_MESSAGE_PROTOCOL:
            {
                Message message = MessagePersister.getInstance().decode(buffer, null);
                return new MessageDescribe(message);
            }
        case ADD_REF:
            {
                final RefEncoding encoding = new RefEncoding();
                encoding.decode(buffer);
                return new ReferenceDescribe(encoding);
            }
        case ACKNOWLEDGE_REF:
            {
                final RefEncoding encoding = new RefEncoding();
                encoding.decode(buffer);
                return new AckDescribe(encoding);
            }
        case UPDATE_DELIVERY_COUNT:
            {
                DeliveryCountUpdateEncoding updateDeliveryCount = new DeliveryCountUpdateEncoding();
                updateDeliveryCount.decode(buffer);
                return updateDeliveryCount;
            }
        case PAGE_TRANSACTION:
            {
                if (info.isUpdate) {
                    PageUpdateTXEncoding pageUpdate = new PageUpdateTXEncoding();
                    pageUpdate.decode(buffer);
                    return pageUpdate;
                } else {
                    PageTransactionInfoImpl pageTransactionInfo = new PageTransactionInfoImpl();
                    pageTransactionInfo.decode(buffer);
                    pageTransactionInfo.setRecordID(info.id);
                    return pageTransactionInfo;
                }
            }
        case SET_SCHEDULED_DELIVERY_TIME:
            {
                ScheduledDeliveryEncoding encoding = new ScheduledDeliveryEncoding();
                encoding.decode(buffer);
                return encoding;
            }
        case DUPLICATE_ID:
            {
                DuplicateIDEncoding encoding = new DuplicateIDEncoding();
                encoding.decode(buffer);
                return encoding;
            }
        case HEURISTIC_COMPLETION:
            {
                HeuristicCompletionEncoding encoding = new HeuristicCompletionEncoding();
                encoding.decode(buffer);
                return encoding;
            }
        case ACKNOWLEDGE_CURSOR:
            {
                CursorAckRecordEncoding encoding = new CursorAckRecordEncoding();
                encoding.decode(buffer);
                return encoding;
            }
        case PAGE_CURSOR_COUNTER_VALUE:
            {
                PageCountRecord encoding = new PageCountRecord();
                encoding.decode(buffer);
                return encoding;
            }
        case PAGE_CURSOR_COMPLETE:
            {
                CursorAckRecordEncoding encoding = new PageCompleteCursorAckRecordEncoding();
                encoding.decode(buffer);
                return encoding;
            }
        case PAGE_CURSOR_COUNTER_INC:
            {
                PageCountRecordInc encoding = new PageCountRecordInc();
                encoding.decode(buffer);
                return encoding;
            }
        case PAGE_CURSOR_PENDING_COUNTER:
            {
                PageCountPendingImpl encoding = new PageCountPendingImpl();
                encoding.decode(buffer);
                encoding.setID(info.id);
                return encoding;
            }
        case QUEUE_STATUS_RECORD:
            return AbstractJournalStorageManager.newQueueStatusEncoding(id, buffer);
        case QUEUE_BINDING_RECORD:
            return AbstractJournalStorageManager.newQueueBindingEncoding(id, buffer);
        case ID_COUNTER_RECORD:
            EncodingSupport idReturn = new IDCounterEncoding();
            idReturn.decode(buffer);
            return idReturn;
        case JournalRecordIds.GROUP_RECORD:
            return AbstractJournalStorageManager.newGroupEncoding(id, buffer);
        case ADDRESS_SETTING_RECORD:
            return AbstractJournalStorageManager.newAddressEncoding(id, buffer);
        case SECURITY_RECORD:
            return AbstractJournalStorageManager.newSecurityRecord(id, buffer);
        case ADDRESS_BINDING_RECORD:
            return AbstractJournalStorageManager.newAddressBindingEncoding(id, buffer);
        default:
            return null;
    }
}
Also used : PendingLargeMessageEncoding(org.apache.activemq.artemis.core.persistence.impl.journal.codec.PendingLargeMessageEncoding) LargeServerMessage(org.apache.activemq.artemis.core.server.LargeServerMessage) Message(org.apache.activemq.artemis.api.core.Message) PageCountPendingImpl(org.apache.activemq.artemis.core.persistence.impl.journal.codec.PageCountPendingImpl) PageTransactionInfoImpl(org.apache.activemq.artemis.core.paging.impl.PageTransactionInfoImpl) DeliveryCountUpdateEncoding(org.apache.activemq.artemis.core.persistence.impl.journal.codec.DeliveryCountUpdateEncoding) PageUpdateTXEncoding(org.apache.activemq.artemis.core.persistence.impl.journal.codec.PageUpdateTXEncoding) PageCountRecord(org.apache.activemq.artemis.core.persistence.impl.journal.codec.PageCountRecord) CursorAckRecordEncoding(org.apache.activemq.artemis.core.persistence.impl.journal.codec.CursorAckRecordEncoding) ScheduledDeliveryEncoding(org.apache.activemq.artemis.core.persistence.impl.journal.codec.ScheduledDeliveryEncoding) DuplicateIDEncoding(org.apache.activemq.artemis.core.persistence.impl.journal.codec.DuplicateIDEncoding) PageCountRecordInc(org.apache.activemq.artemis.core.persistence.impl.journal.codec.PageCountRecordInc) LargeServerMessage(org.apache.activemq.artemis.core.server.LargeServerMessage) HeuristicCompletionEncoding(org.apache.activemq.artemis.core.persistence.impl.journal.codec.HeuristicCompletionEncoding) RefEncoding(org.apache.activemq.artemis.core.persistence.impl.journal.codec.RefEncoding) ActiveMQBuffer(org.apache.activemq.artemis.api.core.ActiveMQBuffer) EncodingSupport(org.apache.activemq.artemis.core.journal.EncodingSupport) IDCounterEncoding(org.apache.activemq.artemis.core.persistence.impl.journal.BatchingIDGenerator.IDCounterEncoding)

Aggregations

ActiveMQBuffer (org.apache.activemq.artemis.api.core.ActiveMQBuffer)1 Message (org.apache.activemq.artemis.api.core.Message)1 EncodingSupport (org.apache.activemq.artemis.core.journal.EncodingSupport)1 PageTransactionInfoImpl (org.apache.activemq.artemis.core.paging.impl.PageTransactionInfoImpl)1 IDCounterEncoding (org.apache.activemq.artemis.core.persistence.impl.journal.BatchingIDGenerator.IDCounterEncoding)1 CursorAckRecordEncoding (org.apache.activemq.artemis.core.persistence.impl.journal.codec.CursorAckRecordEncoding)1 DeliveryCountUpdateEncoding (org.apache.activemq.artemis.core.persistence.impl.journal.codec.DeliveryCountUpdateEncoding)1 DuplicateIDEncoding (org.apache.activemq.artemis.core.persistence.impl.journal.codec.DuplicateIDEncoding)1 HeuristicCompletionEncoding (org.apache.activemq.artemis.core.persistence.impl.journal.codec.HeuristicCompletionEncoding)1 PageCountPendingImpl (org.apache.activemq.artemis.core.persistence.impl.journal.codec.PageCountPendingImpl)1 PageCountRecord (org.apache.activemq.artemis.core.persistence.impl.journal.codec.PageCountRecord)1 PageCountRecordInc (org.apache.activemq.artemis.core.persistence.impl.journal.codec.PageCountRecordInc)1 PageUpdateTXEncoding (org.apache.activemq.artemis.core.persistence.impl.journal.codec.PageUpdateTXEncoding)1 PendingLargeMessageEncoding (org.apache.activemq.artemis.core.persistence.impl.journal.codec.PendingLargeMessageEncoding)1 RefEncoding (org.apache.activemq.artemis.core.persistence.impl.journal.codec.RefEncoding)1 ScheduledDeliveryEncoding (org.apache.activemq.artemis.core.persistence.impl.journal.codec.ScheduledDeliveryEncoding)1 LargeServerMessage (org.apache.activemq.artemis.core.server.LargeServerMessage)1