Package org.codehaus.activemq.service

Examples of org.codehaus.activemq.service.Subscription


            sub.messageConsumed(ack);
        }
    }

    public void acknowledgeTransactedMessage(BrokerClient client, String transactionId, MessageAck ack) throws JMSException {
        Subscription sub = subscriptionContainer.getSubscription(ack.getConsumerId());
        if (sub != null) {
            sub.onAcknowledgeTransactedMessageBeforeCommit(ack);
        }
    }
View Full Code Here


            sub.onAcknowledgeTransactedMessageBeforeCommit(ack);
        }
    }

    public void redeliverMessage(BrokerClient client, MessageAck ack) throws JMSException {
        Subscription sub = subscriptionContainer.getSubscription(ack.getConsumerId());
        if (sub != null) {
            sub.redeliverMessage(null, ack);
        }
    }
View Full Code Here

                container = persistenceAdapter.createQueueMessageContainer(destinationName);
                container.start();
                messageContainers.put(destinationName, container);
                //Add any interested Subscriptions to the new Container
                for (Iterator iter = subscriptionContainer.subscriptionIterator(); iter.hasNext();) {
                    Subscription sub = (Subscription) iter.next();
                    if (sub.isBrowser()) {
                        updateBrowsers(container, sub);
                    }
                    else {
                        updateActiveSubscriptions(container, sub);
                    }
View Full Code Here

    public Iterator subscriptionIterator() {
        return subscriptions.values().iterator();
    }

    public Subscription makeSubscription(Dispatcher dispatcher, ConsumerInfo info, Filter filter) {
        Subscription subscription = createSubscription(dispatcher, info, filter);
        subscriptions.put(info.getConsumerId(), subscription);
        return subscription;
    }
View Full Code Here

        return subscription;
    }

    public void checkForDuplicateDurableSubscription(BrokerClient client, ConsumerInfo info) throws JMSException {
        for (Iterator iter = subscriptions.values().iterator(); iter.hasNext();) {
            Subscription subscription = (Subscription) iter.next();
            if (subscription.isSameDurableSubscription(info)) {
                throw new DuplicateDurableSubscriptionException(info);
            }
        }
    }
View Full Code Here

     * @return
     */
    public Map getLocalDestinations() {
        Map localDestinations = new HashMap();
        for (Iterator iter = subscriptionContainer.subscriptionIterator(); iter.hasNext();) {
            Subscription sub = (Subscription) iter.next();
            if (sub.isLocalSubscription()) {
                final ActiveMQDestination dest = sub.getDestination();
                localDestinations.put(dest.getPhysicalName(), dest);
            }
        }
        return Collections.unmodifiableMap(localDestinations);
    }
View Full Code Here

        }
         
        //ensure a matching container exists for the destination
        getContainer(info.getDestination().getPhysicalName());
       
        Subscription sub = subscriptionContainer.makeSubscription(dispatcher, client,info, createFilter(info));
        dispatcher.addActiveSubscription(client, sub);
        updateActiveSubscriptions(sub);

        // set active last in case we end up dispatching some messages
        // while recovering
        sub.setActive(true);
    }
View Full Code Here

        if (log.isDebugEnabled()) {
            log.debug("Removing consumer: " + info);
        }
        if (info.getDestination() != null && info.getDestination().isQueue()) {
            synchronized (subscriptionMutex) {
                Subscription sub = (Subscription) subscriptionContainer.removeSubscription(info.getConsumerId());
                if (sub != null) {
                    sub.setActive(false);
                    sub.clear();//resets entries in the QueueMessageContainer
                    dispatcher.removeActiveSubscription(client, sub);
                    //need to do wildcards for this - but for now use exact matches
                    for (Iterator iter = messageContainers.values().iterator(); iter.hasNext();) {
                        QueueMessageContainer container = (QueueMessageContainer) iter.next();
                        //should change this for wild cards ...
                        if (container.getDestinationName().equals(sub.getDestination().getPhysicalName())) {
                            QueueList list = getSubscriptionList(container);
                            list.remove(sub);
                            if (list.isEmpty()) {
                                activeSubscriptions.remove(sub.getDestination().getPhysicalName());
                            }
                            list = getBrowserList(container);
                            list.remove(sub);
                            if (list.isEmpty()) {
                                browsers.remove(sub.getDestination().getPhysicalName());
                            }
                        }
                    }
                }
            }
View Full Code Here

    public void acknowledgeMessage(final BrokerClient client, final MessageAck ack) throws JMSException {
        // Are we not intrested in handling that destination?
        if( !isManagerFor(ack.getDestination(), ack.isPersistent()) ) {
          return;
        }
        final Subscription sub = subscriptionContainer.getSubscription(ack.getConsumerId());
        if (sub == null){
            return;
        }

        sub.messageConsumed(ack);
        if (ack.isMessageRead()) {
            updateAcknowledgeStats(client, sub);
        }
    }
View Full Code Here

    protected MessageContainer createContainer(String destinationName) throws JMSException {
        QueueMessageContainer container = persistenceAdapter.createQueueMessageContainer(destinationName);

        //Add any interested Subscriptions to the new Container
        for (Iterator iter = subscriptionContainer.subscriptionIterator(); iter.hasNext();) {
            Subscription sub = (Subscription) iter.next();
            if (sub.isBrowser()) {
                updateBrowsers(container, sub);
            }
            else {
                updateActiveSubscriptions(container, sub);
            }
View Full Code Here

TOP

Related Classes of org.codehaus.activemq.service.Subscription

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.