Package org.activemq.service

Examples of org.activemq.service.MessageIdentity


    protected void dumpMessageIdentities(String text) throws JMSException {
        System.out.println("#### Dumping identities at: " + text);
        for (int i = 0; i < publishMessageCount; i++) {
            ActiveMQMessage message = getMessage(i);
            MessageIdentity identity = message.getJMSMessageIdentity();
            Object sequenceNo = identity.getSequenceNumber();
            String sequenceText = null;
            if (sequenceNo != null) {
                sequenceText = toStringFromSequenceNumber(sequenceNo);
            }
            System.out.println("item: " + i + " is: " + sequenceText);
View Full Code Here


                                      if( op.operationType == TxOperation.REMOVE_OPERATION_TYPE) {
                                          op.store.replayRemoveMessage((MessageAck) op.data);
                                      }
                                      if( op.operationType == TxOperation.ACK_OPERATION_TYPE) {
                                          JournalAck ack = (JournalAck) op.data;
                                          ((JournalTopicMessageStore)op.store).replayAcknowledge(ack.getSubscription(), new MessageIdentity(ack.getMessageId()));
                                      }
                                  }
                                  transactionCounter++;
                              }
                              break;
                          case TxCommand.LOCAL_ROLLBACK:
                          case TxCommand.XA_ROLLBACK:
                              transactionStore.replayRollback(command.getTransactionId());
                              break;
                        }
                       
                        break;
                       
                    case ACK_RECORD_TYPE:
                       
                        destination = is.readUTF();
                        String subscription = is.readUTF();
                        String messageId = is.readUTF();
                        Object transactionId=null;
                       
                        JournalTopicMessageStore store = (JournalTopicMessageStore) createMessageStore(destination, false);
                        if( transactionId!=null ) {
                            JournalAck ack = new JournalAck(destination, subscription, messageId, transactionId);
                            transactionStore.acknowledge(store, ack, pos);
                        } else {
                            store.replayAcknowledge(subscription, new MessageIdentity(messageId));
                            transactionCounter++;
                        }
                       
                    case COMMAND_RECORD_TYPE:
View Full Code Here

        transactionTemplate.run(new Callback() {
            public void execute() throws Throwable {
                writeMessage(0);

                // lets delete using a String which should cause a warning
                MessageIdentity messageIdentity = new MessageIdentity(messageIds[0]);
                container.delete(messageIdentity, createMessageAck(messageIdentity));
            }
        });

        System.out.println("About to write: " + messageCount + " messages to the container: " + container);
View Full Code Here

        return xaTransacted;
    }

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

     *
     * @Transient
     */
    public MessageIdentity getJMSMessageIdentity() {
        if (jmsMessageIdentity == null) {
            jmsMessageIdentity = new MessageIdentity(this.getJMSMessageID());
        }
        return jmsMessageIdentity;
    }
View Full Code Here

                                  if( op.operationType == TxOperation.REMOVE_OPERATION_TYPE) {
                                      op.store.replayRemoveMessage((MessageAck) op.data);
                                  }
                                  if( op.operationType == TxOperation.ACK_OPERATION_TYPE) {
                                      JournalAck ack = (JournalAck) op.data;
                                      ((JournalTopicMessageStore)op.store).replayAcknowledge(ack.getSubscription(), new MessageIdentity(ack.getMessageId()));
                                  }
                              }
                              transactionCounter++;
                              break;
                          case TxCommand.LOCAL_ROLLBACK:
                          case TxCommand.XA_ROLLBACK:
                              transactionStore.replayRollback(command.getTransactionId());
                              break;
                        }
                       
                        break;
                       
                    case ACK_RECORD_TYPE:
                       
                        destination = is.readUTF();
                        String subscription = is.readUTF();
                        String messageId = is.readUTF();
                        Object transactionId=null;
                       
                        JournalTopicMessageStore store = (JournalTopicMessageStore) createMessageStore(destination, false);
                        if( transactionId!=null ) {
                            JournalAck ack = new JournalAck(destination, subscription, messageId, transactionId);
                            transactionStore.acknowledge(store, ack, pos);
                        } else {
                            store.replayAcknowledge(subscription, new MessageIdentity(messageId));
                            transactionCounter++;
                        }
                       
                    case COMMAND_RECORD_TYPE:
View Full Code Here

                        String subscription = is.readUTF();
                        String messageId = is.readUTF();
                       
                        JournalTopicMessageStore store = (JournalTopicMessageStore) createMessageStore(destination, false);
                        try {                           
                            store.getLongTermTopicMessageStore().setLastAcknowledgedMessageIdentity(subscription, new MessageIdentity(messageId));
                        }
                        catch (Throwable e) {
                            log.error("Recovery Failure: Could not ack message: " + messageId + ", reason: " + e, e);
                        }
                       
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(this.getJMSMessageID());
        }
        return jmsMessageIdentity;
    }
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));
    }
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 {
                    listener.recoverMessage(new MessageIdentity(messageID, new Long(seq)));               
                }
            });    
           
        } catch (SQLException e) {
            throw JMSExceptionHelper.newJMSException("Failed to recover container. Reason: " + e, e);
View Full Code Here

TOP

Related Classes of org.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.