Package org.codehaus.activemq.service

Examples of org.codehaus.activemq.service.MessageIdentity


        this.xaTransacted = xaTransacted;
    }

    public MessageIdentity getMessageIdentity() {
        if (messageIdentity == null) {
            messageIdentity = new MessageIdentity(messageID);
        }
        return messageIdentity;
    }
View Full Code Here


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

    /**
     * @see org.codehaus.activemq.store.TopicMessageStore#getLastestMessageIdentity()
     */
    public MessageIdentity getLastestMessageIdentity() throws JMSException {
        return new MessageIdentity(null, new Long(sequenceGenerator.getLastSequenceId()));
    }
View Full Code Here

       
        try {
            Connection c = TransactionContext.getConnection();           
            adapter.doRecoverSubscription(c, subscription.getPersistentKey(), destinationName, new MessageListResultHandler(){
                public void onMessage(long seq, String messageID) throws JMSException {
                    MessageIdentity messageIdentity = new MessageIdentity(messageID, new Long(seq));
                    ActiveMQMessage message = getMessage(messageIdentity);
                    subscription.addMessage(container, message);
                }
            });
        } catch (SQLException e) {
View Full Code Here

            OperationStatus status = cursor.getLast(keyEntry, valueEntry, LockMode.DEFAULT);
            if (status == OperationStatus.SUCCESS) {
                if (log.isDebugEnabled()) {
                    log.debug("Loaded last sequence number of: " + BDbHelper.longFromBytes(keyEntry.getData()));
                }
                return new MessageIdentity(null, keyEntry);
            }
            else if (status != OperationStatus.NOTFOUND) {
                log.error("Could not find the last sequence number. Status: " + status);
            }
            return null;
View Full Code Here

            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

        }
    }

    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);
                lastAcked = lastDispatchedMessage;
            }
            Object lastAckedSequenceNumber = lastAcked.getSequenceNumber();

            // lets iterate through all IDs from the

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

            adapter.doAddMessage(c, seq, messageID, destinationName, data);
        } catch (SQLException e) {
            throw JMSExceptionHelper.newJMSException("Failed to broker message: " + messageID + " in container: " + e, e);
        }

        MessageIdentity answer = message.getJMSMessageIdentity();
        answer.setSequenceNumber(new Long(seq));
        return answer;
    }
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

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.