Package org.codehaus.activemq.service

Examples of org.codehaus.activemq.service.MessageIdentity


* @version $Revision: 1.2 $
*/
public abstract class QueueMessageStoreTestSupport extends MessageStoreTestSupport {

    protected void acknowledgeMessage(int i) throws JMSException {
        MessageIdentity identity = getMessage(i).getJMSMessageIdentity();
        getQueueMessageContainer().delete(identity, createMessageAck(identity, getMessage(i).getJMSDestination()));
    }
View Full Code Here


        return xaTransacted;
    }

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

      addedMessageLocations.put(message.getJMSMessageIdentity(), location);
    }

    // Update the messageIdentity sequence number so that we can reteive the message
    // from the journal at a later time.
    MessageIdentity messageIdentity = message.getJMSMessageIdentity();
    messageIdentity.setSequenceNumber(location);
    return messageIdentity;
 
View Full Code Here

      public void execute() throws Throwable {
       
        // Checkpoint the added messages.
        Iterator iterator = addedMessageIdentitys.iterator();
        while (iterator.hasNext()) {         
          MessageIdentity identity = (MessageIdentity) iterator.next();
         
          ActiveMQMessage msg = getCacheMessage(identity);
          longTermStore.addMessage(msg);
          synchronized(this) {
            RecordLocation location = (RecordLocation)addedMessageLocations.remove(identity);
View Full Code Here

  /**
   * Add the meessage to the long term store and cache it.
   */
  public MessageIdentity addMessage(ActiveMQMessage message) throws JMSException {   
    MessageIdentity messageIdentity = longTermStore.addMessage(message);
    cache.put(messageIdentity.getMessageID(), message);   
    return messageIdentity;
  }
View Full Code Here

            throw JMSExceptionHelper.newJMSException("Failed to broker message: " + messageID + " in container: " + e, e);
        } finally {
          persistenceAdapter.returnConnection(c);
        }

        MessageIdentity answer = message.getJMSMessageIdentity();
        answer.setSequenceNumber(new Long(seq));
        return answer;
    }
View Full Code Here

        Connection c = null;
        try {
            c = persistenceAdapter.getConnection();           
            adapter.doRecover(c, destinationName, new MessageListResultHandler() {
                public void onMessage(long seq, String messageID) throws JMSException {
                    container.recoverMessageToBeDelivered(new MessageIdentity(messageID, new Long(seq)));               
                }
            });    
           
        } catch (SQLException e) {
            throw JMSExceptionHelper.newJMSException("Failed to recover container. Reason: " + e, e);
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

        Connection c = null;
        try {
            c = persistenceAdapter.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);
                }
            });
        }
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

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.