Package org.codehaus.activemq.service

Examples of org.codehaus.activemq.service.MessageContainer


     * @throws javax.jms.JMSException
     */
    public void sendMessage(BrokerClient client, ActiveMQMessage message) throws JMSException {
        ActiveMQDestination dest = (ActiveMQDestination) message.getJMSDestination();
        if (dest != null && dest.isTopic() && message.getJMSDeliveryMode() == DeliveryMode.PERSISTENT) {
            MessageContainer container = getContainer(message.getJMSDestination().toString());
            Set matchingSubscriptions = subscriptionContainer.getSubscriptions(message.getJMSActiveMQDestination());
            // 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
            container.addMessage(message);
            if (!matchingSubscriptions.isEmpty()) {
                for (Iterator i = matchingSubscriptions.iterator();i.hasNext();) {
                    Subscription sub = (Subscription) i.next();
                    if (sub.isTarget(message)) {
                        sub.addMessage(container, message);
View Full Code Here


    public void redeliverMessage(BrokerClient client, MessageAck ack) throws JMSException {
        Subscription sub = (Subscription) activeSubscriptions.get(ack.getConsumerId());
        if (sub != null) {
            // lets find all the containers that contain this message
            for (Iterator iter = messageContainers.values().iterator();iter.hasNext();) {
                MessageContainer container = (MessageContainer) iter.next();
                if (container.containsMessage(ack.getMessageIdentity())) {
                    sub.redeliverMessage(container, ack);
                    // we only need to redeliver the message from one container
                    break;
                }
            }
View Full Code Here

     * @throws javax.jms.JMSException
     */
    public void sendMessage(BrokerClient client, ActiveMQMessage message) throws JMSException {
        ActiveMQDestination destination = message.getJMSActiveMQDestination();
        if (destination != null && destination.isTopic()) {
            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

            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

     * 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

     * @throws javax.jms.JMSException
     */
    public void sendMessage(BrokerClient client, ActiveMQMessage message) throws JMSException {
        ActiveMQDestination destination = message.getJMSActiveMQDestination();
        if (destination != null && destination.isTopic()) {
            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

            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

TOP

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