Package org.activemq.service

Examples of org.activemq.service.MessageContainer


        ActiveMQDestination dest = (ActiveMQDestination) message.getJMSDestination();
        if (dest != null && dest.isTopic() && message.getJMSDeliveryMode() == DeliveryMode.PERSISTENT) {
            // note that we still need to persist the message even if there are no matching
            // subscribers as they may come along later
            // plus we don't pre-load subscription information               
            final MessageContainer container = getContainer(dest.getPhysicalName());
            container.addMessage(message);
            TransactionManager.getContexTransaction().addPostCommitTask(new TransactionTask() {
                public void execute() throws Throwable {
                    doSendMessage(client, message, container);
                }
            });
View Full Code Here


        ActiveMQDestination dest = (ActiveMQDestination) message.getJMSDestination();
        if (dest != null && dest.isTopic() && message.getJMSDeliveryMode() == DeliveryMode.PERSISTENT) {
            // note that we still need to persist the message even if there are no matching
            // subscribers as they may come along later
            // plus we don't pre-load subscription information               
            final MessageContainer container = getContainer(dest.getPhysicalName());
            container.addMessage(message);
            TransactionManager.getContexTransaction().addPostCommitTask(new TransactionTask() {
                public void execute() throws Throwable {
                    doSendMessage(client, message, container);
                }
            });
View Full Code Here

            firstException = e;
        }

        // lets stop all the containers
        for (Iterator iter = messageContainers.values().iterator(); iter.hasNext();) {
            MessageContainer container = (MessageContainer) iter.next();
            try {
                container.stop();
            }
            catch (JMSException e) {
                if (firstException == null) {
                    firstException = e;
                }
View Full Code Here

        }

    }

    public synchronized MessageContainer getContainer(String destinationName) throws JMSException {
        MessageContainer container = (MessageContainer) messageContainers.get(destinationName);
        if (container == null) {
            container = createContainer(destinationName);
            container.start();
            messageContainers.put(destinationName, container);

            destinations.put(destinationName, createDestination(destinationName));
        }
        return container;
View Full Code Here

    }
   
    synchronized public Map getMessageContainerAdmins() {
        HashMap map = new HashMap(messageContainers.size());
        for (Iterator iter = messageContainers.values().iterator(); iter.hasNext();) {
            MessageContainer mc = (MessageContainer) iter.next();
            map.put(mc.getDestinationName(), mc.getMessageContainerAdmin());           
        }
        return Collections.unmodifiableMap(map);
    }
View Full Code Here

        return Collections.unmodifiableMap(map);
    }
   

    public synchronized void destroyMessageContainer(ActiveMQDestination dest) throws JMSException {
        MessageContainer container = (MessageContainer) messageContainers.get(dest.getPhysicalName());
        if (container != null) {
            container.getMessageContainerAdmin().empty();
            container.stop();
            messageContainers.remove(dest.getPhysicalName());
            destinations.remove(dest.getPhysicalName());
        }
    }
View Full Code Here

     * Loads the container for the given name and destination on startup
     */
    protected void loadContainer(String destinationName, Destination destination) throws JMSException {
        destinations.put(destinationName, destination);

        MessageContainer container = createContainer(destinationName);
        container.start();
        messageContainers.put(destinationName, container);
    }
View Full Code Here

            Set containers = destinationMap.get(dest);
            if (containers != null && !containers.isEmpty()) {
                // note that we still need to persist the message even if there are no matching
                // subscribers as they may come along later
                // plus we don't pre-load subscription information
                final MessageContainer container = getContainer(message.getJMSDestination().toString());
                container.addMessage(message);
                TransactionManager.getContexTransaction().addPostCommitTask(new TransactionTask() {
                    public void execute() throws Throwable {
                        doSendMessage(client, message, container);
                    }
                });
View Full Code Here

     * @param message
     * @param destination
     * @throws JMSException
     */
    private void doSendMessage(BrokerClient client, ActiveMQMessage message, ActiveMQDestination destination) throws JMSException {
        MessageContainer container = null;
        if (log.isDebugEnabled()) {
            log.debug("Dispaching to " + subscriptionContainer + " subscriptions with message: " + message);
        }
        Set subscriptions = subscriptionContainer.getSubscriptions(destination);
        for (Iterator i = subscriptions.iterator(); i.hasNext();) {
            Subscription sub = (Subscription) i.next();
            if (sub.isTarget(message) && (!sub.isDurableTopic() || message.getJMSDeliveryMode() == DeliveryMode.NON_PERSISTENT)) {
                if (container == null) {
                    container = getContainer(message.getJMSDestination().toString());
                    container.addMessage(message);
                }
                sub.addMessage(container, message);
            }
        }
        updateSendStats(client, message);
View Full Code Here

            }
        }
    }

    public MessageContainer getContainer(String destinationName) throws JMSException {
        MessageContainer container = (MessageContainer) messageContainers.get(destinationName);
        if (container == null) {
            synchronized (subscriptionMutex) {
                container = super.getContainer(destinationName);
            }
        }
View Full Code Here

TOP

Related Classes of org.activemq.service.MessageContainer

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.