Package org.codehaus.activemq.message

Examples of org.codehaus.activemq.message.ActiveMQDestination


     * @param client
     * @param info
     * @throws JMSException
     */
    public synchronized void addMessageConsumer(BrokerClient client, ConsumerInfo info) throws JMSException {
        ActiveMQDestination destination = info.getDestination();
        if (destination.isTopic()) {
            TransientTopicBoundedMessageContainer container = (TransientTopicBoundedMessageContainer) containers
                    .get(client);
            if (container == null) {
                MemoryBoundedQueue queue = queueManager.getMemoryBoundedQueue(client.toString());
                container = new TransientTopicBoundedMessageContainer(this, client, queue);
                containers.put(client, container);
                if (started.get()) {
                    container.start();
                }
            }
            if (log.isDebugEnabled()) {
                log.debug("Adding consumer: " + info);
            }

            TransientTopicSubscription ts = container.addConsumer(createFilter(info), info);
            if (ts != null) {
                subscriptions.put(info.getConsumerId(), ts);
            }

            destinationMap.put(destination,container);
            String name = destination.getPhysicalName();
            //As the destinations are used for generating
            //subscriptions for NetworkConnectors etc.,
            //we should not generate duplicates by adding in
            //durable topic subscribers
            if (!info.isDurableTopic() && !destinations.containsKey(name)) {
View Full Code Here


     * @param client
     * @param info
     * @throws JMSException
     */
    public synchronized void removeMessageConsumer(BrokerClient client, ConsumerInfo info) throws JMSException {
        ActiveMQDestination destination = info.getDestination();
        if (destination.isTopic()) {
            TransientTopicBoundedMessageContainer container = (TransientTopicBoundedMessageContainer) containers
                    .get(client);
            if (container != null) {
                container.removeConsumer(info);
                if (container.isInactive()) {
                    containers.remove(client);
                    container.close();
                    destinationMap.remove(destination, container);
                }

                // lets check if we've no more consumers for this destination
                //As the destinations are used for generating
                //subscriptions for NetworkConnectors etc.,
                //we should not count durable topic subscribers
                if (!info.isDurableTopic() && !hasConsumerFor(destination)) {
                    destinations.remove(destination.getPhysicalName());
                }
            }
            subscriptions.remove(info.getConsumerId());
        }
    }
View Full Code Here

    public Map getLocalDestinations() {
        Map localDestinations = new HashMap();
        for (Iterator iter = subscriptions.values().iterator(); iter.hasNext();) {
            TransientTopicSubscription sub = (TransientTopicSubscription) iter.next();
            if (sub.isLocalSubscription() && !sub.isDurableTopic()) {
                final ActiveMQDestination dest = sub.getDestination();
                localDestinations.put(dest.getPhysicalName(), dest);
            }
        }
        return Collections.unmodifiableMap(localDestinations);
    }
View Full Code Here

    public synchronized Set get(ActiveMQDestination key) {
        if (key.isComposite()) {
            List childDestinations = key.getChildDestinations();
            Set answer = new HashSet(childDestinations.size());
            for (Iterator iter = childDestinations.iterator(); iter.hasNext();) {
                ActiveMQDestination childDestination = (ActiveMQDestination) iter.next();
                Object value = get(childDestination);
                if (value instanceof Set) {
                    answer.addAll((Set) value);
                }
                else if (value != null) {
View Full Code Here

    public synchronized void put(ActiveMQDestination key, Object value) {
        if (key.isComposite()) {
            List childDestinations = key.getChildDestinations();
            for (Iterator iter = childDestinations.iterator(); iter.hasNext();) {
                ActiveMQDestination childDestination = (ActiveMQDestination) iter.next();
                put(childDestination, value);
            }
            return;
        }
        String[] paths = key.getDestinationPaths();
View Full Code Here

     */
    public synchronized void remove(ActiveMQDestination key, Object value) {
        if (key.isComposite()) {
            List childDestinations = key.getChildDestinations();
            for (Iterator iter = childDestinations.iterator(); iter.hasNext();) {
                ActiveMQDestination childDestination = (ActiveMQDestination) iter.next();
                remove(childDestination, value);
            }
            return;
        }
        String[] paths = key.getDestinationPaths();
View Full Code Here

     */
    public void removeAll(ActiveMQDestination key) {
        if (key.isComposite()) {
            List childDestinations = key.getChildDestinations();
            for (Iterator iter = childDestinations.iterator(); iter.hasNext();) {
                ActiveMQDestination childDestination = (ActiveMQDestination) iter.next();
                removeAll(childDestination);
            }
            return;
        }
        String[] paths = key.getDestinationPaths();
View Full Code Here

        if (message == null) {
            return;
        }

        boolean consumed = browser ? false : messageRead;
        ActiveMQDestination destination = message.getJMSActiveMQDestination();
        boolean topic = destination != null && destination.isTopic();
        message.setTransientConsumed(!isDurableSubscriber() && topic);
        this.session.afterMessageDelivered((isDurableSubscriber() || this.destination.isQueue()), message, consumed, messageExpired, beforeCalled);
        if (messageRead) {
            stats.onMessage(message);
        }
View Full Code Here

     */
    protected void updateAcknowledgeStats(BrokerClient client, Subscription subscription) {
        if (isMaintainDestinationStats()) {
            // lets lookup the destination which has the stats hanging off it
            String name = subscription.getDestination().getPhysicalName();
            ActiveMQDestination destination = (ActiveMQDestination) destinations.get(name);
            destination.getStats().onMessageAck();
        }
    }
View Full Code Here

     */
    protected void updateSendStats(BrokerClient client, ActiveMQMessage message) throws JMSException {
        if (isMaintainDestinationStats()) {
            // lets lookup the destination which has the stats hanging off it
            String name = message.getJMSActiveMQDestination().getPhysicalName();
            ActiveMQDestination destination = (ActiveMQDestination) destinations.get(name);
            if (destination != null){
                destination.getStats().onMessageSend(message);
            }
        }
    }
View Full Code Here

TOP

Related Classes of org.codehaus.activemq.message.ActiveMQDestination

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.