Examples of MessageContainer


Examples of org.codehaus.activemq.service.MessageContainer

     * @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

Examples of org.codehaus.activemq.service.MessageContainer

            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

Examples of org.codehaus.activemq.service.MessageContainer

        }

    }

    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

Examples of org.codehaus.activemq.service.MessageContainer

    }
   
    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

Examples of org.codehaus.activemq.service.MessageContainer

        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

Examples of org.codehaus.activemq.service.MessageContainer

     * 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

Examples of org.codehaus.activemq.service.MessageContainer

            return;
       
        // 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

Examples of org.codehaus.activemq.service.MessageContainer

     * @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

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());

            // TODO note if we don't have any durable subscriptions then we might back up here
            container.addMessage(message);
            for (Iterator i = subscriptionContainer.subscriptionIterator(); i.hasNext();) {
                Subscription sub = (Subscription) i.next();
                if (sub.isTarget(message)) {
                    sub.addMessage(container, message);
                }
View Full Code Here

Examples of org.codehaus.activemq.service.MessageContainer

    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
TOP
Copyright © 2018 www.massapi.com. 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.