Package org.apache.activemq.command

Examples of org.apache.activemq.command.Message


                    enqueueCounter.incrementAndGet();
                    //localStartedLatch.await();
                    final MessageDispatch md = (MessageDispatch)command;
                    DemandSubscription sub = subscriptionMapByLocalId.get(md.getConsumerId());
                    if (sub != null) {
                        Message message = configureMessage(md);
                        if (trace) {
                            LOG.trace("bridging " + configuration.getBrokerName() + " -> " + remoteBrokerName + ": " + message);
                        }

                        if (!message.isResponseRequired()) {

                            // If the message was originally sent using async
                            // send, we will preserve that QOS
                            // by bridging it using an async send (small chance
                            // of message loss).
View Full Code Here


            }
        }
    }

    private void dispatch(final MessageReference node) throws IOException {
        Message message = (Message)node;
        // Make sure we can dispatch a message.
        MessageDispatch md = new MessageDispatch();
        md.setMessage(message);
        md.setConsumerId(info.getConsumerId());
        md.setDestination(node.getRegionDestination().getActiveMQDestination());
View Full Code Here

        boolean result =  !isEmpty();
        return result;
    }

    public synchronized MessageReference next() {
        Message result = null;
        safeFillBatch();
        if (batchList.isEmpty()) {
            return null;
        } else {
            Iterator i = batchList.entrySet().iterator();
            result = (Message) ((Map.Entry)i.next()).getValue();
            i.remove();
            result.setRegionDestination(regionDestination);
            result.setMemoryUsage(this.getSystemUsage().getMemoryUsage());
        }
        return result;
    }
View Full Code Here

     * @param message
     */ 
    public synchronized void dispatched(MessageReference message) {
        if (this.audit != null) {
            isDuplicate(message.getMessageId());
            Message removed = this.batchList.remove(message.getMessageId());
            if (removed != null) {
                removed.decrementReferenceCount();
            }
        }
    }
View Full Code Here

        pendingCount = 0;
    }

    public synchronized void addMessageLast(MessageReference node) throws Exception {
        if (node != null) {
            Message msg = node.getMessage();
            if (started) {
                pendingCount++;
                if (!msg.isPersistent()) {
                    nonPersistent.addMessageLast(node);
                }
            }
            if (msg.isPersistent()) {
                persistent.addMessageLast(node);
            }
        }
    }
View Full Code Here

        }
    }

    public synchronized void addMessageFirst(MessageReference node) throws Exception {
        if (node != null) {
            Message msg = node.getMessage();
            if (started) {
                pendingCount++;
                if (!msg.isPersistent()) {
                    nonPersistent.addMessageFirst(node);
                }
            }
            if (msg.isPersistent()) {
                persistent.addMessageFirst(node);
            }
        }
    }
View Full Code Here

        }
        return !batchList.isEmpty();
    }

    public synchronized MessageReference next() {
        Message result = batchList.removeFirst();
        result.decrementReferenceCount();
        result.setRegionDestination(regionDestination);
        result.setMemoryUsage(this.getSystemUsage().getMemoryUsage());
        return result;
    }
View Full Code Here

        }
        return true;
    }

    public boolean recoverMessageReference(MessageId messageReference) throws Exception {
        Message msg = store.getMessage(messageReference);
        if (msg != null) {
            return recoverMessage(msg);
        } else {
            String err = "Failed to retrieve message for id: " + messageReference;
            LOG.error(err);
View Full Code Here

            store.removeMessage(context, ack);
        }
    }

    Message loadMessage(MessageId messageId) throws IOException {
        Message msg = store.getMessage(messageId);
        if (msg != null) {
            msg.setRegionDestination(this);
        }
        return msg;
    }
View Full Code Here

        synchronized (pagedInMessages) {
            for (Iterator<MessageReference> i = pagedInMessages.iterator(); i.hasNext();) {
                MessageReference r = i.next();
                r.incrementReferenceCount();
                try {
                    Message m = r.getMessage();
                    if (m != null) {
                        l.add(m);
                    }
                } catch (IOException e) {
                    log.error("caught an exception browsing " + this, e);
                } finally {
                    r.decrementReferenceCount();
                }
            }
        }
        synchronized (messages) {
            try {
                messages.reset();
                while (messages.hasNext()) {
                    try {
                        MessageReference r = messages.next();
                        r.incrementReferenceCount();
                        try {
                            Message m = r.getMessage();
                            if (m != null) {
                                l.add(m);
                            }
                        } finally {
                            r.decrementReferenceCount();
View Full Code Here

TOP

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

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.