Package org.codehaus.activemq.service

Examples of org.codehaus.activemq.service.MessageIdentity


            Transaction transaction = BDbHelper.getTransaction();
            DatabaseEntry key = createKey(messageID);
            DatabaseEntry value = new DatabaseEntry(asBytes(message));
            database.put(transaction, key, value);

            MessageIdentity answer = message.getJMSMessageIdentity();
            answer.setSequenceNumber(sequenceNumberCreator.getLastKey());
            return answer;
        }
        catch (DatabaseException e) {
            throw JMSExceptionHelper.newJMSException("Failed to broker message: " + messageID + " in container: " + e, e);
        }
View Full Code Here


            DatabaseEntry keyEntry = new DatabaseEntry();
            DatabaseEntry valueEntry = new DatabaseEntry();
            OperationStatus status = cursor.getFirst(sequenceNumberEntry, keyEntry, valueEntry, LockMode.DEFAULT);
            while (status == OperationStatus.SUCCESS) {
                String messageID = extractString(keyEntry);
                container.recoverMessageToBeDelivered(new MessageIdentity(messageID, sequenceNumberEntry));
                status = cursor.getNext(sequenceNumberEntry, keyEntry, valueEntry, LockMode.DEFAULT);
            }
            if (status != OperationStatus.NOTFOUND) {
                log.warn("Unexpected status code while recovering: " + status);
            }
View Full Code Here

        try {
            String messageID = message.getJMSMessageID();
            getMessageTable().insert(messageID, entry, true);
            getOrderedIndex().insert(sequenceNumber, messageID, true);

            MessageIdentity answer = message.getJMSMessageIdentity();
            answer.setSequenceNumber(sequenceNumber);
            return answer;
        }
        catch (IOException e) {
            throw JMSExceptionHelper.newJMSException("Failed to add message: " + message + " in container: " + e, e);
        }
View Full Code Here

        try {
            Tuple tuple = new Tuple();
            TupleBrowser iter = getOrderedIndex().browse();
            while (iter.getNext(tuple)) {
                Long key = (Long) tuple.getKey();
                MessageIdentity messageIdentity = null;
                if (key != null) {
                    String messageID = (String) tuple.getValue();
                    if (messageID != null) {
                        messageIdentity = new MessageIdentity(messageID, key);
                    }
                }
                if (messageIdentity != null) {
                    container.recoverMessageToBeDelivered(messageIdentity);
                }
View Full Code Here

     */
    protected ActiveMQMessage getMessageBySequenceNumber(Long sequenceNumber) throws IOException, JMSException {
        ActiveMQMessage message = null;
        String messageID = (String) getOrderedIndex().find(sequenceNumber);
        if (messageID != null) {
            message = getMessage(new MessageIdentity(messageID, sequenceNumber));
        }
        return message;
    }
View Full Code Here

        try {
            Tuple tuple = new Tuple();
            TupleBrowser iter = getOrderedIndex().browse();
            while (iter.getNext(tuple)) {               
                Object sequenceID = tuple.getKey();
                MessageIdentity messageIdentity = null;
                if (sequenceID != null) {
                    String messageID = (String) tuple.getValue();
                    if (messageID != null) {
                        getMessageTable().remove(messageID);
                    }
View Full Code Here

        String messageID = message.getJMSMessageID();
        try {
            Dbt key = createKey(messageID);
            Dbt value = new Dbt(asBytes(message));
            database.put(BDbHelper.getTransaction(), key, value, 0);
            return new MessageIdentity(messageID);
        }
        catch (DbException e) {
            throw JMSExceptionHelper.newJMSException("Failed to broker message: " + messageID + " in container: " + e, e);
        }
        catch (IOException e) {
View Full Code Here

        }
    }

    public synchronized void recoverSubscription(Subscription subscription, MessageIdentity lastDispatchedMessage) throws JMSException {
        try {
            MessageIdentity lastAcked = getLastAcknowledgedMessageIdentity(subscription);
            if (lastAcked == null) {
                // for a new durable subscription lets write the last ack messageID
                // as the previous one that the container delivered to ensure that
                // if we go down before acking anything, we will recover to the right point
                setLastAcknowledgedMessageIdentity(subscription, lastDispatchedMessage);
                return;
            }
            Object lastAckedSequenceNumber = lastAcked.getSequenceNumber();

            // lets iterate through all IDs from the

            //Tuple tuple = new Tuple();
            Tuple tuple = getOrderedIndex().findGreaterOrEqual(lastAckedSequenceNumber);
View Full Code Here

            throw JMSExceptionHelper.newJMSException("Failed to recover subscription: " + subscription + ". Reason: " + e, e);
        }
    }

    public synchronized MessageIdentity getLastestMessageIdentity() throws JMSException {
        return new MessageIdentity(null, new Long(getLastSequenceNumber()));
    }
View Full Code Here

     * @return the message identity, which contains the String messageID
     *         and the lazily populated sequence number
     */
    public MessageIdentity getJMSMessageIdentity() {
        if (jmsMessageIdentity == null) {
            jmsMessageIdentity = new MessageIdentity(getId());
        }
        return jmsMessageIdentity;
    }
View Full Code Here

TOP

Related Classes of org.codehaus.activemq.service.MessageIdentity

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.