Package org.apache.activemq.command

Examples of org.apache.activemq.command.MessageId


     *
     * @param message
     * @return true if the message is a duplicate
     */
    public boolean isDuplicate(final MessageReference message) {
        MessageId id = message.getMessageId();
        return isDuplicate(id);
    }
View Full Code Here


     * mark this message as being received
     *
     * @param message
     */
    public void rollback(final MessageReference message) {
        MessageId id = message.getMessageId();
        rollback(id);
    }
View Full Code Here

                // Only increase the redlivery delay after the first redelivery..
                MessageDispatch lastMd = deliveredMessages.getFirst();
                if (lastMd.getMessage().getRedeliveryCounter() > 0) {
                    redeliveryDelay = redeliveryPolicy.getRedeliveryDelay(redeliveryDelay);
                }
                MessageId firstMsgId = deliveredMessages.getLast().getMessage().getMessageId();
   
                for (Iterator iter = deliveredMessages.iterator(); iter.hasNext();) {
                    MessageDispatch md = (MessageDispatch)iter.next();
                    md.getMessage().onMessageRolledBack();
                }
View Full Code Here

        return info;
    }

    protected Message createMessage(ProducerInfo producerInfo, ActiveMQDestination destination) {
        ActiveMQTextMessage message = new ActiveMQTextMessage();
        message.setMessageId(new MessageId(producerInfo, ++msgIdGenerator));
        message.setDestination(destination);
        message.setPersistent(false);
        try {
            message.setText("Test Message Payload.");
        } catch (MessageNotWriteableException e) {
View Full Code Here

            int count = 0;
            for (Iterator iter = dispatchedMessage.entrySet().iterator(); iter.hasNext();) {

                Map.Entry entry = (Entry)iter.next();
                String id = (String)entry.getKey();
                MessageId msgid = (MessageId)entry.getValue();

                if (ack.getFirstMessageId() == null) {
                    ack.setFirstMessageId(msgid);
                }

                iter.remove();
                count++;

                if (id.equals(messageId)) {
                    ack.setLastMessageId(msgid);
                    break;
                }

            }
            ack.setMessageCount(count);
        }
        else if (ackMode == INDIVIDUAL_ACK) {
            ack.setAckType(MessageAck.INDIVIDUAL_ACK_TYPE);
            MessageId msgid = (MessageId)dispatchedMessage.get(messageId);
            ack.setMessageID(msgid);
            dispatchedMessage.remove(messageId);
        }
        return ack;
    }
View Full Code Here

    /**
     * Not synchronize since the Journal has better throughput if you increase
     * the number of concurrent writes that it is doing.
     */
    public final void addMessage(ConnectionContext context, final Message message) throws IOException {
        final MessageId id = message.getMessageId();
        final Location location = peristenceAdapter.writeCommand(message, message.isResponseRequired());
        if (!context.isInTransaction()) {
            if (debug) {
                LOG.debug("Journalled message add for: " + id + ", at: " + location);
            }
View Full Code Here

            }
        }
    }

    public boolean replayAddMessage(ConnectionContext context, Message message, Location location) {
        MessageId id = message.getMessageId();
        try {
            // Only add the message if it has not already been added.
            ReferenceData data = referenceStore.getMessageReference(id);
            if (data == null) {
                data = new ReferenceData();
View Full Code Here

    final void removeMessage(final MessageAck ack, final Location location) throws InterruptedIOException {
        ReferenceData data;
        lock.lock();
        try{
            lastLocation = location;
            MessageId id = ack.getLastMessageId();
            data = messages.remove(id);
            if (data == null) {
                messageAcks.add(ack);
            } else {
                // message never got written so datafileReference will still exist
View Full Code Here

                    msg.getMessageId().setBrokerSequenceId(sequenceId);
                    return listener.recoverMessage(msg);
                }

                public boolean recoverMessageReference(String reference) throws Exception {
                    return listener.recoverMessageReference(new MessageId(reference));
                }

            });
        } catch (SQLException e) {
            JDBCPersistenceAdapter.log("JDBC Failure: ", e);
View Full Code Here

                    }
                    return false;
                }

                public boolean recoverMessageReference(String reference) throws Exception {
                    return listener.recoverMessageReference(new MessageId(reference));
                }

            });
        } catch (SQLException e) {
            JDBCPersistenceAdapter.log("JDBC Failure: ", e);
View Full Code Here

TOP

Related Classes of org.apache.activemq.command.MessageId

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.